本文整理汇总了C++中DString::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ DString::Append方法的具体用法?C++ DString::Append怎么用?C++ DString::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DString
的用法示例。
在下文中一共展示了DString::Append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pos
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// PBook::ReadEcoFile():
// Read an ECO (not EPD) format file.
errorT
PBook::ReadEcoFile ()
{
MFile fp;
if (fp.Open (FileName, FMODE_ReadOnly) != OK) {
return ERROR_FileOpen;
}
ReadOnly = true;
LineCount = 1;
Position std_start;
std_start.StdStart();
DString text;
DString moves;
ecoStringT ecoStr;
ecoT ecoCode;
int ch;
errorT err = OK;
bool done = false;
// Loop to read in and add all positions:
while (!done) {
// Find the next ECO code:
while (true) {
ch = fp.ReadOneByte();
if (ch == EOF) { done = true; break; }
if (ch == '\n') { LineCount++; }
if (ch >= 'A' && ch <= 'E') { break; }
if (ch == '#') {
while (ch != '\n' && ch != EOF) {
ch = fp.ReadOneByte();
}
if (ch == EOF) { done = true; }
LineCount++;
}
}
if (done) { break; }
// Read in the rest of the ECO code:
ecoStr[0] = ch;
ch = fp.ReadOneByte();
if (ch < '0' || ch > '9') { goto corrupt; }
ecoStr[1] = ch;
ch = fp.ReadOneByte();
if (ch < '0' || ch > '9') { goto corrupt; }
ecoStr[2] = ch;
ecoStr[3] = 0;
// Now check for optional extra part of code, e.g. "A00a1":
ch = fp.ReadOneByte();
if (ch >= 'a' && ch <= 'z') {
ecoStr[3] = ch; ecoStr[4] = 0;
ch = fp.ReadOneByte();
if (ch >= '1' && ch <= '4') {
ecoStr[4] = ch; ecoStr[5] = 0;
}
}
// Now put ecoCode in the text string and read the text in quotes:
ecoCode = eco_FromString (ecoStr);
eco_ToExtendedString (ecoCode, ecoStr);
text.Clear();
text.Append ("eco ", ecoStr, " [");
// Find the start of the text:
while ((ch = fp.ReadOneByte()) != '"') {
if (ch == EOF) { goto corrupt; }
}
while ((ch = fp.ReadOneByte()) != '"') {
if (ch == EOF) { goto corrupt; }
text.AddChar ((char) ch);
}
text.Append ("]\n");
// Now read the position:
moves.Clear();
char prev = 0;
while ((ch = fp.ReadOneByte()) != '*') {
if (ch == EOF) { goto corrupt; }
if (ch == '\n') {
ch = ' ';
LineCount++;
}
if (ch != ' ' || prev != ' ') {
moves.AddChar ((char) ch);
}
prev = ch;
}
Position pos (std_start);
err = pos.ReadLine (moves.Data());
if (err != OK) { goto corrupt; }
text.Append ("moves ", strTrimLeft (moves.Data()), "\n");
if (Insert (&pos, text.Data()) != OK) {
// Position already exists: just ignore it.
}
}
//.........这里部分代码省略.........