Collection of static functions for various string-related operations. More...
Classes | |
struct | natural_sort |
Functions | |
std::string::size_type | count (const std::string &s, const char c) |
std::string::size_type | count (const char *s, const char c) |
bool | match (const UList< wordRe > &patterns, const std::string &text) |
template<class StringType , class UnaryPredicate > | |
StringType | quotemeta (const StringType &str, const UnaryPredicate &meta, const char quote='\\') |
string | expand (const std::string &s, const HashTable< string > &mapping, const char sigil='$') |
void | inplaceExpand (std::string &s, const HashTable< string > &mapping, const char sigil='$') |
void | inplaceExpand (std::string &s, const dictionary &dict, const bool allowEnv, const bool allowEmpty, const bool allowSubDict=false, const char sigil='$') |
string | expand (const std::string &s, const dictionary &dict, const char sigil='$') |
void | inplaceExpand (std::string &s, const dictionary &dict, const char sigil='$') |
string | expand (const std::string &s, const bool allowEmpty=false) |
void | inplaceExpand (std::string &s, const bool allowEmpty=false) |
bool | inplaceReplaceVar (std::string &s, const word &varName) |
template<class StringType , class UnaryPredicate > | |
StringType | validate (const std::string &str, const UnaryPredicate &accept, const bool invert=false) |
std::pair< size_t, size_t > | findTrim (const std::string &s, size_t pos=0, size_t len=std::string::npos) |
string | trimLeft (const std::string &s) |
void | inplaceTrimLeft (std::string &s) |
string | trimRight (const std::string &s) |
void | inplaceTrimRight (std::string &s) |
string | trim (const std::string &s) |
void | inplaceTrim (std::string &s) |
void | inplaceRemoveSpace (std::string &s) |
string | removeComments (const std::string &s) |
void | inplaceRemoveComments (std::string &s) |
string | lower (const std::string &s) |
void | inplaceLower (std::string &s) |
string | upper (const std::string &s) |
void | inplaceUpper (std::string &s) |
label | splitFunctionArgs (const std::string &str, wordRes &args, List< Tuple2< word, string >> &namedArgs) |
template<class StringType > | |
Foam::SubStrings< StringType > | split (const StringType &str, const char delim, const bool keepEmpty=false) |
template<class StringType > | |
Foam::SubStrings< StringType > | split (const StringType &str, const std::string &delim, const bool keepEmpty=false) |
template<class StringType > | |
Foam::SubStrings< StringType > | splitAny (const StringType &str, const std::string &delim) |
template<class StringType > | |
Foam::SubStrings< StringType > | splitFixed (const StringType &str, const std::string::size_type width, const std::string::size_type start=0) |
template<class StringType > | |
Foam::SubStrings< StringType > | splitSpace (const StringType &str) |
void | writeWrapped (OSstream &os, const std::string &str, const std::string::size_type width, const std::string::size_type indent=0, const bool escape=false) |
string | evaluate (label fieldWidth, const std::string &s, size_t pos=0, size_t len=std::string::npos) |
string | evaluate (const std::string &s, size_t pos=0, size_t len=std::string::npos) |
int | natstrcmp (const char *s1, const char *s2) |
Collection of static functions for various string-related operations.
std::string::size_type count | ( | const std::string & | s, |
const char | c | ||
) |
Definition at line 690 of file stringOps.C.
References Foam::constant::universal::c, Foam::BitOps::count(), and s.
Referenced by string::count(), ensightSurfaceReader::replaceMask(), OSstream::write(), and OSstream::writeQuoted().
std::string::size_type count | ( | const char * | s, |
const char | c | ||
) |
Definition at line 699 of file stringOps.C.
References Foam::constant::universal::c, Foam::BitOps::count(), and s.
Definition at line 72 of file stringOps.H.
Referenced by functionObjectList::execute(), degenerateMatcher::match(), regExpCxx::match(), wordRes::matching(), scalars::matching(), triangle2D::nClosePoints(), scalarRanges::operator()(), keyType::operator()(), scalarRange::operator()(), wordRe::operator()(), regExpPosix::operator()(), regExpCxx::operator()(), and triangle2D::snapClosePoints().
StringType quotemeta | ( | const StringType & | str, |
const UnaryPredicate & | meta, | ||
const char | quote = '\\' |
||
) |
Definition at line 25 of file stringOpsTemplates.C.
References Foam::constant::universal::c.
Referenced by ddt2::read().
Foam::string expand | ( | const std::string & | s, |
const HashTable< string > & | mapping, | ||
const char | sigil = '$' |
||
) |
Definition at line 711 of file stringOps.C.
References inplaceExpand(), and s.
Referenced by blockDescriptor::blockDescriptor(), dynamicCode::copyOrCreateFiles(), argList::displayDoc(), exprString::exprString(), functionObjectList::findDict(), Foam::operator<<(), exprString::readEntry(), and STDMD::update().
Definition at line 724 of file stringOps.C.
References HashTable::cfind(), findParameterAlternative(), and s.
Referenced by dynamicCode::copyAndFilter(), expand(), expressionEntry::expand(), exprString::expand(), string::expand(), dynamicCodeContext::inplaceExpand(), exprString::inplaceExpand(), expressionEntry::inplaceExpand(), entry::New(), includeEtcEntry::resolveEtcFile(), and includeEntry::resolveFile().
void inplaceExpand | ( | std::string & | s, |
const dictionary & | dict, | ||
const bool | allowEnv, | ||
const bool | allowEmpty, | ||
const bool | allowSubDict = false , |
||
const char | sigil = '$' |
||
) |
Definition at line 849 of file stringOps.C.
References dict, Foam::expandString(), and s.
Foam::string expand | ( | const std::string & | s, |
const dictionary & | dict, | ||
const char | sigil = '$' |
||
) |
Definition at line 836 of file stringOps.C.
References dict, inplaceExpand(), and s.
void inplaceExpand | ( | std::string & | s, |
const dictionary & | dict, | ||
const char | sigil = '$' |
||
) |
Definition at line 863 of file stringOps.C.
References dict, Foam::expandString(), and s.
Foam::string expand | ( | const std::string & | s, |
const bool | allowEmpty = false |
||
) |
Definition at line 876 of file stringOps.C.
References inplaceExpand(), and s.
void inplaceExpand | ( | std::string & | s, |
const bool | allowEmpty = false |
||
) |
Definition at line 888 of file stringOps.C.
References Foam::expandString(), and s.
Definition at line 899 of file stringOps.C.
References Foam::getEnv(), and s.
StringType validate | ( | const std::string & | str, |
const UnaryPredicate & | accept, | ||
const bool | invert = false |
||
) |
invert | Invert the test logic |
Definition at line 64 of file stringOpsTemplates.C.
References Foam::constant::universal::c, and Foam::invert().
Referenced by surfMesh::addZones(), surfMesh::copySurface(), dictionary::csearchCompat(), IOobject::fileNameComponents(), OBJsurfaceFormat< Face >::read(), ABAQUSsurfaceFormat< Face >::read(), AC3DsurfaceFormat< Face >::read(), NASsurfaceFormat< Face >::read(), Foam::readDir(), splitFunctionArgs(), and surfMesh::transfer().
std::pair<size_t, size_t> Foam::stringOps::findTrim | ( | const std::string & | s, |
size_t | pos = 0 , |
||
size_t | len = std::string::npos |
||
) |
Foam::string trimLeft | ( | const std::string & | s | ) |
Definition at line 923 of file stringOps.C.
References stdFoam::end(), Foam::isspace(), Foam::pos(), and s.
void inplaceTrimLeft | ( | std::string & | s | ) |
Definition at line 945 of file stringOps.C.
References stdFoam::end(), Foam::isspace(), Foam::pos(), and s.
Referenced by inplaceTrim().
Foam::string trimRight | ( | const std::string & | s | ) |
Definition at line 965 of file stringOps.C.
References stdFoam::end(), Foam::isspace(), and s.
void inplaceTrimRight | ( | std::string & | s | ) |
Definition at line 985 of file stringOps.C.
References stdFoam::end(), Foam::isspace(), and s.
Referenced by inplaceTrim(), ensightSurfaceReader::readLine(), and Foam::readUntilBalancedDelimiter().
Foam::string trim | ( | const std::string & | s | ) |
Definition at line 1039 of file stringOps.C.
References stdFoam::end(), Foam::isspace(), Foam::pos(), and s.
Referenced by exprDriver::addVariables(), bitSet::orEq(), splitFunctionArgs(), and bitSet::xorEq().
void inplaceTrim | ( | std::string & | s | ) |
Definition at line 1060 of file stringOps.C.
References inplaceTrimLeft(), inplaceTrimRight(), and s.
Referenced by exprDriver::addVariables(), dynamicCodeContext::inplaceExpand(), expressionEntry::inplaceExpand(), Foam::recursiveExpand(), and exprString::trim().
void inplaceRemoveSpace | ( | std::string & | s | ) |
Definition at line 1067 of file stringOps.C.
References Foam::isspace(), and s.
Referenced by Foam::getIdentifier().
Foam::string removeComments | ( | const std::string & | s | ) |
Definition at line 1073 of file stringOps.C.
References inplaceRemoveComments(), and s.
Referenced by exprString::exprString().
void inplaceRemoveComments | ( | std::string & | s | ) |
Definition at line 1081 of file stringOps.C.
References Foam::constant::universal::c, Foam::isspace(), n, and s.
Referenced by exprString::inplaceExpand(), and removeComments().
Foam::string lower | ( | const std::string & | s | ) |
Definition at line 1177 of file stringOps.C.
References s, and Foam::transform().
Referenced by dynamicOversetFvMesh::addInterpolation(), LduMatrix< Type, DType, LUType >::Amul(), lduMatrix::Amul(), GAMGAgglomeration::checkRestriction(), STLAsciiParseManual::execute(), labelRange::join(), FixedList< Type, 3 >::moveFirst(), UList< Foam::wordRe >::moveFirst(), lduMatrix::operator*=(), LduMatrix< Type, DType, LUType >::operator+=(), lduMatrix::operator+=(), LduMatrix< Type, DType, LUType >::operator-=(), lduMatrix::operator-=(), LduMatrix< Type, DType, LUType >::operator=(), lduMatrix::operator=(), labelRanges::remove(), LduMatrix< Type, DType, LUType >::residual(), lduMatrix::residual(), faMatrix< Type >::setValuesFromList(), fvMatrix< Type >::setValuesFromList(), fvMatrix< Type >::solveCoupled(), fvMatrix< Type >::solveSegregated(), labelRange::subset(), labelRange::subset0(), LduMatrix< Type, DType, LUType >::sumA(), lduMatrix::sumA(), LduMatrix< Type, DType, LUType >::Tmul(), lduMatrix::Tmul(), fvMatrix< Type >::transferFvMatrixCoeffs(), lduPrimitiveMesh::upperTriOrder(), and dynamicOversetFvMesh::write().
void inplaceLower | ( | std::string & | s | ) |
Definition at line 1187 of file stringOps.C.
References s, and Foam::transform().
Referenced by STARCDMeshReader::readBoundary().
Foam::string upper | ( | const std::string & | s | ) |
Definition at line 1193 of file stringOps.C.
References s, and Foam::transform().
Referenced by dynamicOversetFvMesh::addInterpolation(), ABAQUSCore::readHelper::addNewElset(), LduMatrix< Type, DType, LUType >::Amul(), lduMatrix::Amul(), GAMGAgglomeration::checkRestriction(), Foam::getIdentifier(), labelRange::join(), Foam::lessThan(), FixedList< Type, 3 >::moveLast(), UList< Foam::wordRe >::moveLast(), lduMatrix::operator*=(), LduMatrix< Type, DType, LUType >::operator+=(), lduMatrix::operator+=(), LduMatrix< Type, DType, LUType >::operator-=(), lduMatrix::operator-=(), LduMatrix< Type, DType, LUType >::operator=(), lduMatrix::operator=(), argList::printMan(), ABAQUSCore::readHelper::read(), ABAQUSCore::readHelper::readSurfaceElements(), labelRanges::remove(), LduMatrix< Type, DType, LUType >::residual(), lduMatrix::residual(), faMatrix< Type >::setValuesFromList(), fvMatrix< Type >::setValuesFromList(), fvMatrix< Type >::solveCoupled(), fvMatrix< Type >::solveSegregated(), labelRange::subset(), labelRange::subset0(), LduMatrix< Type, DType, LUType >::sumA(), lduMatrix::sumA(), FixedList< Type, 3 >::swapLast(), UList< Foam::wordRe >::swapLast(), LduMatrix< Type, DType, LUType >::Tmul(), lduMatrix::Tmul(), fvMatrix< Type >::transferFvMatrixCoeffs(), lduPrimitiveMesh::upperTriOrder(), and dynamicOversetFvMesh::write().
void inplaceUpper | ( | std::string & | s | ) |
Definition at line 1203 of file stringOps.C.
References s, and Foam::transform().
Foam::label splitFunctionArgs | ( | const std::string & | str, |
wordRes & | args, | ||
List< Tuple2< word, string >> & | namedArgs | ||
) |
Definition at line 50 of file stringOpsSplit.C.
References args, Foam::constant::universal::c, Foam::name(), Foam::pos(), argList::size(), trim(), and validate().
Referenced by functionObjectList::readFunctionObject().
Foam::SubStrings< StringType > split | ( | const StringType & | str, |
const char | delim, | ||
const bool | keepEmpty = false |
||
) |
Definition at line 91 of file stringOpsTemplates.C.
References SubStrings::append(), and stdFoam::end().
Referenced by dictionary::makeScopedDict().
Foam::SubStrings< StringType > split | ( | const StringType & | str, |
const std::string & | delim, | ||
const bool | keepEmpty = false |
||
) |
Definition at line 127 of file stringOpsTemplates.C.
References SubStrings::append(), and stdFoam::end().
Foam::SubStrings< StringType > splitAny | ( | const StringType & | str, |
const std::string & | delim | ||
) |
Definition at line 163 of file stringOpsTemplates.C.
References SubStrings::append(), stdFoam::end(), and Foam::pos().
Referenced by scalarRanges::parse(), and splitSpace().
Foam::SubStrings< StringType > splitFixed | ( | const StringType & | str, |
const std::string::size_type | width, | ||
const std::string::size_type | start = 0 |
||
) |
Definition at line 204 of file stringOpsTemplates.C.
References SubStrings::append(), stdFoam::end(), and Foam::pos().
Foam::SubStrings< StringType > splitSpace | ( | const StringType & | str | ) |
Definition at line 239 of file stringOpsTemplates.C.
References splitAny().
Referenced by argList::displayDoc(), OBJsurfaceFormat< Face >::read(), OBJedgeFormat::read(), and ensightSurfaceReader::readCase().
void writeWrapped | ( | OSstream & | os, |
const std::string & | str, | ||
const std::string::size_type | width, | ||
const std::string::size_type | indent = 0 , |
||
const bool | escape = false |
||
) |
Definition at line 1210 of file stringOps.C.
References Foam::constant::universal::c, stdFoam::end(), Foam::indent(), Foam::isspace(), Foam::nl, os(), and Foam::pos().
Referenced by argList::printMan(), Foam::printManOption(), argList::printNotes(), and Foam::printOptionUsage().
Foam::string evaluate | ( | label | fieldWidth, |
const std::string & | s, | ||
size_t | pos = 0 , |
||
size_t | len = std::string::npos |
||
) |
InfoErr<< "Evaluate " << str.substr(pos, len) << nl;
InfoErr<< "Evaluate " << str.substr(pos, len) << nl;
Definition at line 30 of file stringOpsEvaluate.C.
References findTrim(), exprResult::hasValue(), Foam::InfoErr, Foam::nl, os(), parseDriver::parse(), Foam::pos(), exprDriver::result(), exprResult::size(), exprResult::writeField(), and exprResult::writeValue().
Referenced by alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField(), alphaContactAngleTwoPhaseFvPatchScalarField::alphaContactAngleTwoPhaseFvPatchScalarField(), uniformFixedValuePointPatchField< Type >::autoMap(), uniformFixedValueFvPatchField< Type >::autoMap(), uniformNormalFixedValueFvPatchVectorField::autoMap(), scaledFixedValueFvPatchField< Type >::autoMap(), basicSymmetryFaPatchField< Type >::basicSymmetryFaPatchField(), basicSymmetryFvPatchField< Type >::basicSymmetryFvPatchField(), constantAlphaContactAngleFvPatchScalarField::constantAlphaContactAngleFvPatchScalarField(), cyclicACMIFvPatchField< Type >::cyclicACMIFvPatchField(), cyclicAMIFvPatchField< scalar >::cyclicAMIFvPatchField(), cyclicFaPatchField< Type >::cyclicFaPatchField(), cyclicFvPatchField< vector >::cyclicFvPatchField(), BlendedInterfacialModel< ModelType >::D(), directionMixedFvPatchField< Type >::directionMixedFvPatchField(), BlendedInterfacialModel< ModelType >::dmdt(), dynamicAlphaContactAngleFvPatchScalarField::dynamicAlphaContactAngleFvPatchScalarField(), energyJumpAMIFvPatchScalarField::energyJumpAMIFvPatchScalarField(), energyJumpFvPatchScalarField::energyJumpFvPatchScalarField(), evaluate(), basicSymmetryFvPatchField< Type >::evaluate(), basicSymmetryFaPatchField< Type >::evaluate(), extrapolatedCalculatedFvPatchField< Type >::evaluate(), alphaContactAngleTwoPhaseFvPatchScalarField::evaluate(), symmetryPlaneFvPatchField< Type >::evaluate(), coupledFvPatchField< vector >::evaluate(), valuePointPatchField< vector >::evaluate(), kqRWallFunctionFvPatchField< Type >::evaluate(), fixedGradientFaPatchField< Type >::evaluate(), mixedFaPatchField< Type >::evaluate(), directionMixedFvPatchField< Type >::evaluate(), fluxCorrectedVelocityFvPatchVectorField::evaluate(), fixedGradientFvPatchField< Type >::evaluate(), partialSlipFvPatchField< Type >::evaluate(), fixedNormalSlipFvPatchField< Type >::evaluate(), codedFixedValueFvPatchField< Type >::evaluate(), codedFixedValuePointPatchField< Type >::evaluate(), codedMixedFvPatchField< Type >::evaluate(), mixedFvPatchField< vector >::evaluate(), wordDirective::execute(), calcEntry::execute(), messageDirective::execute(), evalEntry::execute(), ifeqEntry::execute(), codeStream::execute(), externalCoupledTemperatureMixedFvPatchScalarField::externalCoupledTemperatureMixedFvPatchScalarField(), extrapolatedCalculatedFvPatchField< Type >::extrapolatedCalculatedFvPatchField(), BlendedInterfacialModel< ModelType >::F(), fanFvPatchField< Type >::fanFvPatchField(), BlendedInterfacialModel< ModelType >::Ff(), fixedGradientFaPatchField< Type >::fixedGradientFaPatchField(), fixedGradientFvPatchField< Type >::fixedGradientFvPatchField(), fixedJumpAMIFvPatchField< scalar >::fixedJumpAMIFvPatchField(), fixedJumpFvPatchField< vector >::fixedJumpFvPatchField(), fixedNormalSlipFvPatchField< Type >::fixedNormalSlipFvPatchField(), fixedProfileFvPatchField< Type >::fixedProfileFvPatchField(), flowRateInletVelocityFvPatchVectorField::flowRateInletVelocityFvPatchVectorField(), flowRateOutletVelocityFvPatchVectorField::flowRateOutletVelocityFvPatchVectorField(), CrankNicolsonDdtScheme< Type >::fvcDdt(), CrankNicolsonDdtScheme< Type >::fvcDdtPhiCorr(), CrankNicolsonDdtScheme< Type >::fvcDdtUfCorr(), CrankNicolsonDdtScheme< Type >::fvmDdt(), interfaceCompressionFvPatchScalarField::interfaceCompressionFvPatchScalarField(), BlendedInterfacialModel< ModelType >::K(), BlendedInterfacialModel< ModelType >::Kf(), matchedFlowRateOutletVelocityFvPatchVectorField::matchedFlowRateOutletVelocityFvPatchVectorField(), CrankNicolsonDdtScheme< Type >::meshPhi(), mixedFaPatchField< Type >::mixedFaPatchField(), mixedFvPatchField< vector >::mixedFvPatchField(), transformFaPatchField< Type >::operator=(), transformFvPatchField< Type >::operator=(), partialSlipFvPatchField< Type >::partialSlipFvPatchField(), Foam::recursiveExpand(), temperatureDependentAlphaContactAngleFvPatchScalarField::temperatureDependentAlphaContactAngleFvPatchScalarField(), timeVaryingAlphaContactAngleFvPatchScalarField::timeVaryingAlphaContactAngleFvPatchScalarField(), timeVaryingMappedFixedValueFvPatchField< Type >::timeVaryingMappedFixedValueFvPatchField(), timeVaryingMappedFixedValuePointPatchField< Type >::timeVaryingMappedFixedValuePointPatchField(), uniformDensityHydrostaticPressureFvPatchScalarField::uniformDensityHydrostaticPressureFvPatchScalarField(), uniformFixedGradientFvPatchField< Type >::uniformFixedGradientFvPatchField(), uniformFixedValueFvPatchField< Type >::uniformFixedValueFvPatchField(), uniformFixedValuePointPatchField< Type >::uniformFixedValuePointPatchField(), uniformJumpAMIFvPatchField< Type >::uniformJumpAMIFvPatchField(), uniformJumpFvPatchField< Type >::uniformJumpFvPatchField(), uniformNormalFixedValueFvPatchVectorField::uniformNormalFixedValueFvPatchVectorField(), pressureInletOutletVelocityFvPatchVectorField::updateCoeffs(), fixedNormalInletOutletVelocityFvPatchVectorField::updateCoeffs(), wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField(), wedgeFaPatchField< Type >::wedgeFaPatchField(), and wedgeFvPatchField< Type >::wedgeFvPatchField().
Foam::string evaluate | ( | const std::string & | s, |
size_t | pos = 0 , |
||
size_t | len = std::string::npos |
||
) |
Definition at line 87 of file stringOpsEvaluate.C.
References evaluate(), and Foam::pos().
int natstrcmp | ( | const char * | s1, |
const char * | s2 | ||
) |
Definition at line 118 of file stringOpsSort.C.
Referenced by natural_sort::compare().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.