本文整理汇总了C++中StString::iterator方法的典型用法代码示例。如果您正苦于以下问题:C++ StString::iterator方法的具体用法?C++ StString::iterator怎么用?C++ StString::iterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StString
的用法示例。
在下文中一共展示了StString::iterator方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseLine
void StLangMap::parseLine(const StString& theLine) {
if(myIsHeaderSection) {
myIsHeaderSection = !(theLine == StString(HEADER_SECTION_DELIM));
}
for(StUtf8Iter anIter = theLine.iterator(); *anIter != 0; ++anIter) {
if(*anIter != stUtf32_t('=')) {
// not interesting
continue;
}
size_t aKey = size_t(std::atol(theLine.subString(0, anIter.getIndex()).toCString()));
// get value without quotes
StString aValue = theLine.subString(anIter.getIndex() + 2, theLine.getLength() - 1);
///TODO (Kirill Gavrilov#9) add all replacements
for(anIter = aValue.iterator(); *anIter != 0; ++anIter) {
if(*anIter.getBufferHere() == stUtf8_t('\\') && *anIter.getBufferNext() == stUtf8_t('n')) {
// this is a hacking code in fact...
*(stUtf8_t* )anIter.getBufferHere() = stUtf8_t(' ');
*(stUtf8_t* )anIter.getBufferNext() = stUtf8_t('\n');
}
}
myMap.insert(std::pair<size_t, StString>(aKey, aValue));
return;
}
}
示例2: decodeHotKey
unsigned int decodeHotKey(const StString& theString) {
unsigned int aKey = 0;
if(theString.isEmpty()) {
return aKey;
}
// decode flags (split by + separator)
StUtf8Iter aFrom = theString.iterator();
StUtf8Iter anIter = theString.iterator();
for(; *anIter != 0; ++anIter) {
if(*anIter == stUtf32_t('+')) {
if(anIter.getIndex() == 0) {
return ST_VK_OEM_PLUS; // single '+'
}
const StCStringUtf8 aSubStr = {
aFrom.getBufferHere(),
size_t(anIter.getBufferHere() - aFrom.getBufferHere()),
anIter.getIndex() - aFrom.getIndex()
};
if(aSubStr.isEquals(THE_VKEYS_NAMES[ST_VK_SHIFT])) {
aKey |= ST_VF_SHIFT;
} else if(aSubStr.isEquals(THE_VKEYS_NAMES[ST_VK_CONTROL])) {
aKey |= ST_VF_CONTROL;
}
aFrom = anIter;
++aFrom;
}
}
// decode VKey itself
const StCStringUtf8 aSubStr = {
aFrom.getBufferHere(),
size_t(anIter.getBufferHere() - aFrom.getBufferHere()),
anIter.getIndex() - aFrom.getIndex()
};
if(aSubStr.Size == 1) {
// optimized code for letters
if(*aSubStr.String >= 'A'
&& *aSubStr.String <= 'Z') {
aKey |= (unsigned int )*aSubStr.String;
return aKey;
} else if(*aSubStr.String >= '0'
&& *aSubStr.String <= '9') {
aKey |= (unsigned int )*aSubStr.String;
return aKey;
}
}
for(unsigned int aKeyIter = 0; aKeyIter <= 223; ++aKeyIter) {
if(aSubStr.isEquals(THE_VKEYS_NAMES[aKeyIter])) {
aKey |= aKeyIter;
break;
}
}
return aKey;
}
示例3: getExtension
StString StFileNode::getExtension(const StString& theFileName) {
size_t aPntId = size_t(-1);
for(StUtf8Iter anIter = theFileName.iterator(); *anIter != 0; ++anIter) {
if(*anIter == stUtf32_t('.')) {
aPntId = anIter.getIndex();
}
}
return (aPntId != size_t(-1)) ? theFileName.subString(aPntId + 1, theFileName.getLength()) : StString();
}
示例4: parseString
void StDictEntry::parseString(const StString& theString) {
for(StUtf8Iter anIter = theString.iterator(); *anIter != 0; ++anIter) {
if(*anIter == stUtf32_t('=')) {
myKey = theString.subString(0, anIter.getIndex());
myValue = theString.subString(anIter.getIndex() + 1, theString.getLength()).unquoted();
return;
}
}
myKey = theString;
}
示例5: isInteger
bool stUtfTools::isInteger(const StString& theString) {
StUtf8Iter anIter = theString.iterator();
// TODO (Kirill Gavrilov#9) + and - should be followed by numbers!
if(!isNumChar(*anIter) && (*anIter != stUtf32_t('+')) && (*anIter != stUtf32_t('-'))) {
return false;
}
++anIter;
for(; *anIter != 0; ++anIter) {
if(!isNumChar(*anIter)) {
return false;
}
}
return true;
}
示例6: getProcessFolder
StString StProcess::getProcessFolder() {
StString aFullPath = getProcessFullPath();
size_t aLastSplit = size_t(-1);
for(StUtf8Iter anIter = aFullPath.iterator(); *anIter != 0; ++anIter) {
if(*anIter == stUtf32_t(SYS_FS_SPLITTER)) {
aLastSplit = anIter.getIndex();
}
}
if(aLastSplit != size_t(-1)) {
return aFullPath.subString(0, aLastSplit + 1); // including trailing separator!
} else {
return StString();
}
}
示例7: getProcessName
StString StProcess::getProcessName() {
StString aFullPath = getProcessFullPath();
size_t aLastSplit = size_t(-1);
for(StUtf8Iter anIter = aFullPath.iterator(); *anIter != 0; ++anIter) {
if(*anIter == stUtf32_t(SYS_FS_SPLITTER)) {
aLastSplit = anIter.getIndex();
}
}
if(aLastSplit != size_t(-1)) {
return aFullPath.subString(aLastSplit + 1, aFullPath.getLength());
} else {
return aFullPath;
}
}
示例8: getNameAndExtension
void StFileNode::getNameAndExtension(const StString& theFileName,
StString& theName,
StString& theExtension) {
size_t aLastPnt = size_t(-1);
for(StUtf8Iter anIter = theFileName.iterator(); *anIter != 0; ++anIter) {
if(*anIter == stUtf32_t('.')) {
aLastPnt = anIter.getIndex();
}
}
if(aLastPnt != size_t(-1)) {
theName = theFileName.subString(0, aLastPnt);
theExtension = theFileName.subString(aLastPnt + 1, theFileName.getLength());
} else {
theName = theFileName;
theExtension = StString();
}
}
示例9: getFolderAndFile
void StFileNode::getFolderAndFile(const StString& theFilePath,
StString& theFolder,
StString& theFileName) {
size_t aLastSplit = size_t(-1);
for(StUtf8Iter anIter = theFilePath.iterator(); *anIter != 0; ++anIter) {
if(*anIter == stUtf32_t(SYS_FS_SPLITTER)) {
aLastSplit = anIter.getIndex();
}
}
if(aLastSplit != size_t(-1)) {
theFolder = theFilePath.subString(0, aLastSplit);
theFileName = theFilePath.subString(aLastSplit + 1, theFilePath.getLength());
} else {
theFolder = StString();
theFileName = theFilePath;
}
}
示例10: getFolderUp
StString StFileNode::getFolderUp(const StString& thePath) {
size_t aLastSplit = size_t(-1);
size_t aPreSplit = size_t(-1);
for(StUtf8Iter anIter = thePath.iterator(); *anIter != 0; ++anIter) {
if(*anIter == stUtf32_t(SYS_FS_SPLITTER)) {
aPreSplit = aLastSplit;
aLastSplit = anIter.getIndex();
}
}
if(aLastSplit != size_t(-1)
&& aLastSplit + 1 == thePath.getLength()) {
aLastSplit = aPreSplit;
}
if(aLastSplit == size_t(-1)) {
return StString();
}
return thePath.subString(0, aLastSplit);
}