OpenASIP
2.0
|
#include <StringTools.hh>
Static Public Member Functions | |
static std::string | trim (const std::string &source) |
static char * | stringToCharPtr (const std::string &source) |
static bool | containsChar (const std::string &source, char ch, bool caseSensitive=true) |
static bool | endsWith (const std::string &source, const std::string &searchString) |
static std::string | stringToUpper (const std::string &source) |
static std::string | stringToLower (const std::string &source) |
static bool | ciEqual (const std::string &a, const std::string &b) |
static std::vector< TCEString > | chopString (const std::string &source, const std::string &delimiters) |
static void | chopString (const std::string &source, const std::string &delimiter, std::vector< std::string > &results) |
static std::string | splitToRows (const std::string &original, const unsigned int rowLength) |
static std::string | replaceAllOccurrences (const std::string &source, const std::string &occurrence, const std::string &newString) |
static std::string | indent (int level) |
Definition at line 44 of file StringTools.hh.
|
static |
Chops string using a given delimiter.
Result is returned as a vector. Extra blanks are ignored.
source | String to be chopped. |
delimiter | Delimiter used. |
store | String vector reference where result strings are stored. |
Definition at line 212 of file StringTools.cc.
References trim().
|
static |
Chops string using a given delimiter.
Result is returned as a vector. Extra blanks are ignored.
source | String to be chopped. |
delimiter | Delimiter used. |
Definition at line 181 of file StringTools.cc.
References trim().
Referenced by UserManualCmd::Do(), VectorLSGenerator::explore(), llvm::LLVMTCERISCVIntrinsicsLowering::findOperationName(), llvm::LLVMTCERISCVIntrinsicsLowering::findRegs(), GenerateProcessor::generateProcessor(), SimpleScriptInterpreter::interpret(), ConfigurationFile::parse(), Environment::parsePathEnvVariable(), and TCEString::split().
|
static |
Returns true if two strings are equal if the case is not taken into account.
a | A string. |
b | Another string. |
Definition at line 240 of file StringTools.cc.
References stringToLower().
Referenced by MemDumpCommand::execute(), MemWriteCommand::execute(), InfoRegistersCommand::execute(), SimulatorFrontend::findPort(), findRegisterFile(), SocketCodeTable::fuPortCode(), DCMFUResourceConflictDetector::operationID(), ReservationTableFUResourceConflictDetector::operationID(), and SimulatorFrontend::state().
|
static |
Checks whether a string contains a char or not.
source | The investigated string. |
ch | Character which is checked whether it is in a string or not. |
caseSensitive | Flag indicating whether checking is case sensitive or not. |
Definition at line 101 of file StringTools.cc.
References stringToUpper().
Referenced by BaseLineReader::charQuestion(), llvm::LLVMTCEBuilder::emitOperationMacro(), llvm::LLVMTCERISCVIntrinsicsLowering::findOperationName(), and llvm::LLVMTCERISCVIntrinsicsLowering::findRegs().
|
static |
Checks whether a string ends with the given search string.
source | The investigated string. |
searchString | The string to search from the end. |
Definition at line 126 of file StringTools.cc.
Referenced by AutoSelectImplementationsDialog::AutoSelectImplementationsDialog(), BlockImplementationDialog::BlockImplementationDialog(), PluginTools::findModule(), OperationPropertyDialog::saveOperation(), GenerateProcessor::validIntegratorParameters(), and QuartusProjectGenerator::writeQSFFile().
|
static |
Returns a (vhdl) indention string
level | Indention level (one level is 2 spaces) |
Definition at line 319 of file StringTools.cc.
Referenced by HDLGenerator::Port::declare(), HDLGenerator::Register::declare(), HDLGenerator::Parameter::declare(), HDLGenerator::BinaryConstant::declare(), HDLGenerator::IntegerConstant::declare(), HDLGenerator::Wire::declare(), HDLGenerator::Variable::declare(), HDLGenerator::Module::declare(), VhdlRomGenerator::generateComponentFile(), HDLGenerator::LHSValue::hdl(), HDLGenerator::HDLOperation::hdl(), HDLGenerator::RawCodeLine::hdl(), HDLGenerator::DefaultAssign::hdl(), HDLGenerator::Assign::hdl(), HDLGenerator::DefaultCase::hdl(), HDLGenerator::Case::hdl(), HDLGenerator::Switch::hdl(), HDLGenerator::If::hdl(), HDLGenerator::Asynchronous::hdl(), HDLGenerator::Synchronous::hdl(), HDLGenerator::Module::implement(), ProGe::VerilogNetlistWriter::indentation(), ProGe::VHDLNetlistWriter::indentation(), HDLGenerator::Module::instantiate(), HDLGenerator::Register::reset(), and HDLGenerator::Synchronous::vhdlReset().
|
static |
Replaces all occurrences of 'occurrence' in 'source' with 'newString'
source | The source string to be modified |
occurrence | The string occurrences to be replaced |
newString | The string that's replaced over the found occurrences |
Definition at line 295 of file StringTools.cc.
Referenced by llvm::LLVMTCERISCVIntrinsicsLowering::findOperationName(), and ProGeTestBenchGenerator::generate().
|
static |
Splits a string into rows.
The original string is split in to rows containing a maximum of 'rowLength' characters. After 'rowLength' characters a new-line character is inserted to the string to be returned. If the given string has less than 'rowLength' characters, the string is returned as it was. Also, the "last row" may have less than 'rowLength' characters.
If 'rowLength' is 0, the original string is returned.
original | The string to be split into rows. |
rowLength | The length of a row in the returned string. |
Definition at line 262 of file StringTools.cc.
|
static |
Converts string to char*.
source | The string to be converted. |
Definition at line 83 of file StringTools.cc.
Referenced by TclInterpreter::addCustomCommandToInterpreter(), EditLineReader::charQuestion(), TclInterpreter::dataObjectToTclObj(), EditLineReader::initialize(), TclInterpreter::interpret(), EditLineReader::readLine(), TclInterpreter::removeCustomCommandFromInterpreter(), TclInterpreter::setVariableToInterpreter(), and TclInterpreter::variable().
|
static |
Converts a string to lower case letters.
source | String to be converted. |
Definition at line 160 of file StringTools.cc.
Referenced by MachineState::addPortState(), StaticProgramAnalyzer::addProgram(), MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), InputFUBroker::allAvailableResources(), ConfigurationFile::booleanValue(), DesignSpaceExplorerPlugin::booleanValue(), DataObject::boolValue(), FUGen::buildReplaces(), MachineConnectivityCheck::busConnectedToAnyFU(), ProGeTools::canGenerateFromDAG(), Automagic::canGenerateFromDAG(), TCEString::capitalize(), ciEqual(), FUGen::constantName(), FUGen::createOperationResources(), FUGen::DAGNodeOperandWidth(), ProGe::CUOpcodeGenerator::encodings(), StrictMatchFUEstimator::estimateEnergy(), InterpolatingFUEstimator::estimateEnergy(), EnableBPCommand::execute(), InfoCommand::execute(), SettingCommand::execute(), InfoProcCommand::execute(), InfoStatsCommand::execute(), InfoProgramCommand::execute(), ProGeTools::findInOptionList(), Automagic::findInOptionList(), llvm::LLVMTCERISCVIntrinsicsLowering::findOperationName(), SimulatorFrontend::findPort(), ComponentImplementationSelector::fuArchsByOpSetWithMinLatency(), FUGen::FUGen(), ProGeTools::generateableDAGOperations(), Automagic::generateableDAGOperations(), llvm::LLVMTCEBuilder::getHWOperation(), MachineInfo::getOpset(), TTAMachine::FunctionUnit::hasOperation(), TTAMachine::HWOperation::HWOperation(), llvm::LLVMTCEBuilder::initDataSections(), POMDisassembler::isCallOrJump(), FUTestbenchGenerator::isShiftOrRotOp(), TDGen::llvmOperationName(), TDGen::llvmOperationPattern(), llvm::LLVMTCEIRBuilder::LLVMTCEIRBuilder(), TCEString::lower(), MachineInfo::maxMemoryAlignment(), Automagic::nodeLatency(), ProGeTools::nodeLatency(), OperationPoolPimpl::operation(), TTAMachine::FunctionUnit::operation(), FUResourceConflictDetector::operationID(), TTAMachine::OperationTriggeredOperand::OperationTriggeredOperand(), SimControlLanguageCommand::parseBreakpoint(), MachineState::portState(), FUGen::prepareSnippet(), SimProgramBuilder::processBidirTerminal(), FUGen::readFile(), FUGen::readImplementation(), FUGen::scheduleOperations(), TTAMachine::OperationTriggeredOperand::setName(), TTAMachine::HWOperation::setName(), FUGen::subOpConnection(), FUGen::subOpName(), TDGen::writeBackendCode(), and FUTestbenchGenerator::writeInputPortStimulus().
|
static |
Converts a string to upper case letters.
source | String to be converted. |
Definition at line 143 of file StringTools.cc.
Referenced by UtilizationStats::calculateForInstruction(), TCEString::capitalize(), ConfigurationFile::checkSemantics(), containsChar(), ProximFUDetailsCmd::Do(), TDGen::emulatingOpNodeLLVMName(), InfoProcCommand::execute(), InfoStatsCommand::execute(), ExecutionPipelineResourceTable::ExecutionPipelineResourceTable(), SimulatorFrontend::finishSimulation(), FUFiniteStateAutomaton::FUFiniteStateAutomaton(), generateHeader(), TDGen::getLLVMPatternWithConstants(), HDB::FUImplementation::hasOpcode(), OperationBehaviorLoader::importBehavior(), OperationPimpl::loadState(), HDB::FUImplementation::opcode(), FUFiniteStateAutomaton::operationCollisionMatrix(), ResourceVectorFUResourceConflictDetector::operationID(), FSAFUResourceConflictDetector::operationID(), TTAMachine::ResourceVectorSet::resourceVector(), TTAMachine::ResourceVectorSet::ResourceVectorSet(), DataDependenceGraph::setMachine(), HDB::FUImplementation::setOpcode(), TDGen::supportedStackAccessOperations(), OperationSerializer::toOperation(), HDB::FUImplementation::unsetOpcode(), OperationPropertyDialog::updateOperation(), TCEString::upper(), TDGen::writeInstrInfo(), TDGen::writeOperationDef(), ProGe::CUOpcodeGenerator::WriteVerilogOpcodePackage(), and ProGe::CUOpcodeGenerator::WriteVhdlOpcodePackage().
|
static |
Removes leading and trailing whitespace from the string.
source | The string to trim. |
Definition at line 55 of file StringTools.cc.
Referenced by SimControlLanguageCommand::askConditionFromUser(), SimControlLanguageCommand::askExpressionFromUser(), PlatformIntegrator::chopSignalToTag(), chopString(), IPXactHibiInterface::createInstanceName(), ProximSimulationThread::Entry(), CommandsCommand::execute(), EnableBPCommand::execute(), ProjectFileGenerator::extractFUName(), HDLTemplateInstantiator::getPlaceholderDefault(), HDLTemplateInstantiator::getPlaceholderKey(), SimpleScriptInterpreter::interpret(), TclInterpreter::interpret(), main(), ConfigurationFile::parse(), SimControlLanguageCommand::parseDataAddressExpression(), SimControlLanguageCommand::parseInstructionAddressExpression(), SimulatorCLI::run(), OperationPropertyDialog::saveOperation(), DesignSpaceExplorer::simulate(), ConfigurationFile::timeStampValue(), and EditLineReader::updateHistory().