本文整理汇总了C++中STRING::end方法的典型用法代码示例。如果您正苦于以下问题:C++ STRING::end方法的具体用法?C++ STRING::end怎么用?C++ STRING::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STRING
的用法示例。
在下文中一共展示了STRING::end方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
// Load and decompress NBT file
bool NBT_Reader::Load(const STRING file)
{
gzFile zload = 0;
#ifdef UNICODE
std::string sFile(file.begin(), file.end());
zload = gzopen(sFile.c_str(), "rb");
#else
zload = gzopen(file.c_str(), "rb");
#endif
BYTE buffer[BUFFER_SIZE] = {0};
std::string load;
int a = -1;
do
{
a = gzread(zload, buffer, BUFFER_SIZE);
if (a > 0)
load.append(buffer, buffer+a);
}
while (a > 0);
gzclose(zload);
// Invalid
if (load[0] != 10)
return false;
int size = load.size();
data = new BYTE[size];
memcpy(data, load.c_str(), size);
pointer = data;
return true;
}
示例2:
TEST_F(is_IS_PhoneNumber, Operator) {
cxxfaker::providers::is_IS::PhoneNumber phonenumber;
phonenumber.Seed(::testing::UnitTest::GetInstance()->random_seed());
STRING number = phonenumber;
for (STRING::const_iterator iter = number.begin(); iter != number.end(); ++iter) {
if (isdigit(*iter) || *iter == '+' || *iter == ' ')
continue;
ADD_FAILURE() << "What is this \"" << *iter << "\" doing in here..";
};
};
示例3: FormatPattern
SNORTRULEHDR void CRuleOption::FormatPattern(CDllString &out)
{
m_nFlags = CRuleOption::NOFLAG;
STRING str = out.Data();
STRING_ITER iBeg = str.begin(), iEnd = str.end();
if (*std::find_if_not(iBeg, iEnd, ISSPACE()) == '!')
{
m_nFlags |= CRuleOption::HASNOT;
}
QuotedContext(iBeg, iEnd);
out.Assign(STRING(iBeg, iEnd).c_str());
}
示例4: searchTest
void searchTest(const STRING& text, const STRING *keyTbl, size_t keySize)
{
FMINDEX f;
f.init(text.begin(), text.end());
compareText(f, text, keyTbl, keySize);
std::stringstream ss;
f.save(ss);
{
FMINDEX ff;
ff.load(ss);
compareText(ff, text, keyTbl, keySize);
}
}
示例5: file
// Working thread
THREAD_FUNCTION(PixelMap::WorkingLevel, data)
{
GoThread * go = (GoThread*)data;
Level * level = go->level;
if (level)
{
STRING folder = *go->folder;
go->error = level->LoadWorld(folder);
if (go->error != LVL_OK)
{
go->running = false;
return 0;
}
STRING save = *go->save;
go->error = level->CreateImage(save);
if (go->error != LVL_OK)
{
go->running = false;
return 0;
}
STRING w = Port::FileName(folder);
std::string world;
world.assign(w.begin(), w.end());
// Save log
if (level->prefs.logging)
{
using namespace std;
ofstream file(level->prefs.log.c_str());
if (file.is_open())
{
INT64 total = 0;
for (int i = 0; i < DATAVALUES_AMOUNT; ++i)
total += level->amount.block[i];
int digits = 0;
{
INT64 t = level->amount.filesize;
t /= 1000000;
while (t > 0)
{
++digits;
t /= 10;
}
}
double size = level->amount.filesize;
size /= 1000000;
stringstream stream;
stream.setf(ios_base::dec, ios::floatfield);
stream.precision(2 + digits);
#define END "\n"
#define SEP(t) setSeparator(t)
stream << world << END
<< size << "MB" << END << END
<< "Map surface: " << SEP(level->blocks) << END
<< "Total blocks: " << SEP(total) << END << END
<< "Air: " << SEP(level->amount.block[AIR]) << END
<< "Stone: " << SEP(level->amount.block[STONE]) << END
<< "Dirt: " << SEP(level->amount.block[GRASS] + level->amount.block[DIRT]) << END
<< "Water: " << SEP(level->amount.block[WATER] + level->amount.block[STATIONARYWATER]) << END
<< "Clay: " << SEP(level->amount.block[CLAY]) << END
<< "Sand: " << SEP(level->amount.block[SAND]) << END
<< "Gravel: " << SEP(level->amount.block[GRAVEL]) << END << END
<< "Log: " << SEP(level->amount.block[LOG]) << END
<< "Leaves: " << SEP(level->amount.block[LEAVES]) << END
<< "Sapling: " << SEP(level->amount.block[SAPLING]) << END << END
<< "Soil: " << SEP(level->amount.block[SOIL]) << END
<< "Crops: " << SEP(level->amount.block[CROPS]) << END << END
<< "Reed: " << SEP(level->amount.block[REED]) << END
<< "Cactus: " << SEP(level->amount.block[CACTUS]) << END
<< "Red Mushroom: " << SEP(level->amount.block[REDMUSHROOM]) << END
<< "Brown Mushroom: " << SEP(level->amount.block[BROWNMUSHROOM]) << END
<< "Red rose: " << SEP(level->amount.block[REDROSE]) << END
<< "Yellow flower: " << SEP(level->amount.block[YELLOWFLOWER]) << END << END
<< "Ice: " << SEP(level->amount.block[ICE]) << END
<< "Snow: " << SEP(level->amount.block[SNOW]) << END
<< "Snow Block: " << SEP(level->amount.block[SNOWBLOCK]) << END << END
<< "Fire: " << SEP(level->amount.block[FIRE]) << END << END
<< "Diamond Ore: " << SEP(level->amount.block[DIAMONDORE]) << END
<< "Iron Ore: " << SEP(level->amount.block[IRONORE]) << END
<< "Coal Ore: " << SEP(level->amount.block[COALORE]) << END
<< "Gold Ore: " << SEP(level->amount.block[GOLDORE]) << END
<< "Redstone: " << SEP(level->amount.block[REDSTONEORE] + level->amount.block[GLOWINGREDSTONEORE]) << END
<< "Lapiz Lazuli Ore: " << SEP(level->amount.block[LAPIZLAZULIORE]) << END
<< "Obsidian: " << SEP(level->amount.block[OBSIDIAN]) << END
<< "Mossy Cobblestone: " << SEP(level->amount.block[MOSSYCOBBLESTONE]) << END
<< "Bedrock (Adminium): " << SEP(level->amount.block[BEDROCK]) << END << END
//.........这里部分代码省略.........
示例6: DoArgs
// Go through all gui controls
void PixelMap::DoArgs(GUI_Creator * gui)
{
if (!gui)
return;
using namespace std;
// Parameters
ResetArgs();
BOOL b;
if (gui->Get(GUI_ALPHA, b))
{
worldVersion = ALPHA;
}
else if (gui->Get(GUI_BETA, b))
{
worldVersion = BETA;
}
if (gui->Get(GUI_WORLD, b))
{
wstring temp;
//gui->Get(GUI_WORLDFILE, temp);
int i = 0;
gui->GetData(GUI_WORLDFILE, &i);
STRING temp2 = worlds[i];
temp.assign(temp2.begin(), temp2.end());
map = temp;
if (worldVersion == ALPHA)
{
if (map < 0 || map > 5)
map = 1;
if (map > 0 && map <= 5)
{
map = L"World" + map.s;
}
}
}
else if (gui->Get(GUI_CUSTOM, b))
{
wstring temp;
gui->Get(GUI_CUSTOMFILE, temp);
map = temp;
}
// Savefile
gui->Get(GUI_OUTPUT, saveFile);
// Texture
gui->Get(GUI_TEXTURE, texture);
// Cache
if (gui->Get(GUI_CACHE, b) && gui->Get(GUI_CACHEFILE, cache) && cache.empty())
{
// Default cache
STRING str = GetTemp();
cache.assign(str.begin(), str.end());
}
// Log
if (gui->Get(GUI_LOG, b) && gui->Get(GUI_LOGFILE, logFile) == 0)
logFile = L"log.txt";
// Bools
nether = !!gui->Get(GUI_NETHER, b);
night = !!gui->Get(GUI_NIGHT, b);
noRender = !!gui->Get(GUI_NORENDER, b);
caveMode = !!gui->Get(GUI_CAVEMODE, b);
autoClose = !!gui->Get(GUI_AUTO_CLOSE, b);
openFolder = !!gui->Get(GUI_OPEN_FOLDER, b);
noHeightMap = !!gui->Get(GUI_NOHEIGHTMAP, b);
// Rotation
{
wstring temp;
gui->Get(GUI_ROTATE, temp);
rotation = _wtoi(temp.c_str());
}
// Modes
// Normal
if (gui->Get(GUI_NORMAL, b))
height = 0;
// Height
else if (gui->Get(GUI_FREQ, b))
{
wstring temp;
gui->Get(GUI_FREQ_H, temp);
height = _wtoi(temp.c_str());
// Limit
if (height <= 1 || height > MAPZ / 8)
height = 0;
}
// Gray
else if (gui->Get(GUI_GRAY, b))
height = -1;
// Color
else if (gui->Get(GUI_COLOR, b))
height = -2;
//.........这里部分代码省略.........
示例7: FromPattern
SNORTRULEHDR void CPcreOption::FromPattern(const CDllString &strPat)
{
CDllString strTemp = strPat;
FormatPattern(strTemp);
if (HasFlags(CRuleOption::HASNOT))
{
return;
}
STRING str = strTemp.Data();
STRING_ITER iBeg = str.begin(), iEnd = str.end();
STRING strSuffix;
if (*iBeg == '/')
{
++iBeg;
for(--iEnd; *iEnd != '/' && iEnd != str.begin(); --iEnd);
if (iBeg >= iEnd)
{
TTHROW(TI_INVALIDDATA);
}
strSuffix = STRING(iEnd + 1, str.end());
}
m_strPcre.Assign(STRING(iBeg, iEnd).c_str());
for(STRING_ITER j = strSuffix.begin(); j != strSuffix.end(); ++j)
{
switch (*j)
{
case 'A':
AddFlags(PF_A);
if (m_strPcre[0] != '^')
{
m_strPcre.Insert(0, '^');
}
continue;
case 'R':
AddFlags(PF_R);
continue;
case 'i':
AddFlags(PF_i);
continue;
case 's':
AddFlags(PF_s);
continue;
case 'm':
AddFlags(PF_m);
continue;
case 'x':
AddFlags(PF_x);
continue;
case 'E':
AddFlags(PF_E);
continue;
case 'G':
AddFlags(PF_G);
continue;
case 'U':
AddFlags(PF_U);
continue;
case 'B':
AddFlags(PF_B);
continue;
case 'P':
AddFlags(PF_P);
continue;
case 'H':
AddFlags(PF_H);
continue;
case 'M':
AddFlags(PF_M);
continue;
case 'C':
AddFlags(PF_C);
continue;
case 'O':
AddFlags(PF_O);
continue;
case 'I':
AddFlags(PF_I);
continue;
case 'D':
AddFlags(PF_D);
continue;
case 'K':
AddFlags(PF_K);
continue;
case 'S':
AddFlags(PF_S);
continue;
case 'Y':
AddFlags(PF_Y);
continue;
default:
TTHROW(TI_INVALIDDATA);
}
}
if (m_strPcre[0] == '^')
//.........这里部分代码省略.........
示例8: strtoupper
inline STRING utils::strtoupper(STRING str)
{
std::transform(str.begin(), str.end(), str.begin(), toupper);
return str;
}