本文整理汇总了C++中festring::CStr方法的典型用法代码示例。如果您正苦于以下问题:C++ festring::CStr方法的具体用法?C++ festring::CStr怎么用?C++ festring::CStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类festring
的用法示例。
在下文中一共展示了festring::CStr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Buffer
inputfile::inputfile(const festring& FileName,
const valuemap* ValueMap,
truth AbortOnErr)
: Buffer(fopen(FileName.CStr(), "rb")),
FileName(FileName), ValueMap(ValueMap)
{
if(AbortOnErr && !IsOpen())
ABORT("File %s not found!", FileName.CStr());
}
示例2: WriteLog
void logentry::WriteLog(const festring& FileName)
{
FILE* LogFile = fopen(FileName.CStr(), "a");
if(!LogFile) return;
festring Sep = CONST_S(":");
festring Subst = CONST_S("_");
festring::SearchAndReplace(Name, Sep, Subst);
festring::SearchAndReplace(Ktyp, Sep, Subst);
festring::SearchAndReplace(Kaux, Sep, Subst);
festring::SearchAndReplace(Killer, Sep, Subst);
festring::SearchAndReplace(Msg, Sep, Subst);
festring::SearchAndReplace(Place, Sep, Subst);
// XXX duplicating game::GetTime()
int Hour = 12 + Tick / 2000;
int Day = Hour/24 + 1;
Hour %= 24;
int Min = Tick % 2000 * 60 / 2000;
fprintf(LogFile, "name=%s:start=%ld:end=%ld:hp=%d:mhp=%d:ktyp=%s:kaux=%s"
":killer=%s:msg=%s:place=%s:sc=%d"
":turn=%d:dur=%ld:time=Day %d, %d_%02d\n",
Name.CStr(),
(long)Start, (long)End, Hp, Mhp,
Ktyp.CStr(),
Kaux.CStr(),
Killer.CStr(),
Msg.CStr(),
Place.CStr(),
Score,
Turn,
(long)Dur,
Day, Hour, Min
);
if(fclose(LogFile))
{
// error: cannot write to log
}
}
示例3: ReadNumber
long inputfile::ReadNumber(int CallLevel, truth PreserveTerminator)
{
long Value = 0;
static festring Word;
truth NumberCorrect = false;
for(;;)
{
ReadWord(Word);
char First = Word[0];
if(isdigit(First))
{
Value = atoi(Word.CStr());
NumberCorrect = true;
continue;
}
if(Word.GetSize() == 1)
{
if(First == ';' || First == ',' || First == ':')
{
if(CallLevel != HIGHEST || PreserveTerminator)
ungetc(First, Buffer);
return Value;
}
if(First == ')')
{
if((CallLevel != HIGHEST && CallLevel != 4) || PreserveTerminator)
ungetc(')', Buffer);
return Value;
}
if(First == '~')
{
Value = ~ReadNumber(4);
NumberCorrect = true;
continue;
}
/* Convert this into an inline function! */
#define CHECK_OP(op, cl)\
if(First == #op[0])\
if(cl < CallLevel)\
{\
Value op##= ReadNumber(cl);\
NumberCorrect = true;\
continue;\
}\
else\
{\
ungetc(#op[0], Buffer);\
return Value;\
}
CHECK_OP(&, 1); CHECK_OP(|, 1); CHECK_OP(^, 1);
CHECK_OP(*, 2); CHECK_OP(/, 2); CHECK_OP(%, 2);
CHECK_OP(+, 3); CHECK_OP(-, 3);
if(First == '<')
{
char Next = Get();
if(Next == '<')
if(1 < CallLevel)
{
Value <<= ReadNumber(1);
NumberCorrect = true;
continue;
}
else
{
ungetc('<', Buffer);
ungetc('<', Buffer);
return Value;
}
else
ungetc(Next, Buffer);
}
if(First == '>')
{
char Next = Get();
if(Next == '>')
if(1 < CallLevel)
{
Value >>= ReadNumber(1);
NumberCorrect = true;
continue;
}
else
{
ungetc('>', Buffer);
ungetc('>', Buffer);
return Value;
//.........这里部分代码省略.........