本文整理汇总了C++中festring类的典型用法代码示例。如果您正苦于以下问题:C++ festring类的具体用法?C++ festring怎么用?C++ festring使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了festring类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetName
festring material::GetName(truth Articled, truth Adjective) const
{
static festring Name;
Name.Empty();
AddName(Name, Articled, Adjective);
return Name;
}
开发者ID:znation,项目名称:ivan,代码行数:7,代码来源:materia.cpp
示例2: IgnoreCaseFind
festring::sizetype festring::IgnoreCaseFind(const festring& Where,
const festring& What,
sizetype Begin)
{
if(What.IsEmpty())
return Begin;
for(; Where.GetSize() >= What.GetSize() + Begin; ++Begin)
if(::Capitalize(Where[Begin]) == ::Capitalize(What[0]))
{
truth Equal = true;
for(sizetype c = 1; c < What.GetSize(); ++c)
if(::Capitalize(Where[Begin + c]) != ::Capitalize(What[c]))
{
Equal = false;
break;
}
if(Equal)
return Begin;
}
return NPos;
}
开发者ID:jarpiain,项目名称:ivan-tty,代码行数:25,代码来源:festring.cpp
示例3: GetName
festring id::GetName(int Case, int Amount) const
{
static festring Name;
Name.Empty();
AddName(Name, Case, Amount);
return Name;
}
开发者ID:jarpiain,项目名称:ivan-tty,代码行数:7,代码来源:id.cpp
示例4: 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());
}
开发者ID:jarpiain,项目名称:ivan-tty,代码行数:9,代码来源:save.cpp
示例5: SearchAndReplace
void festring::SearchAndReplace(festring& Where, const festring& What,
const festring& With, sizetype Begin)
{
for(sizetype Pos = Where.Find(What, Begin);
Pos != NPos; Pos = Where.Find(What, Pos))
{
Where.Erase(Pos, What.GetSize());
Where.Insert(Pos, With);
}
}
开发者ID:jarpiain,项目名称:ivan-tty,代码行数:10,代码来源:festring.cpp
示例6: SearchAndReplace
void festring::SearchAndReplace(festring& Where, cfestring& What,
cfestring& With, sizetype Begin)
{
if(What.IsEmpty())
ABORT("Infinite loops in SearchAndReplace detected!");
for(sizetype Pos = Where.Find(What, Begin);
Pos != NPos; Pos = Where.Find(What, Pos))
{
Where.Erase(Pos, What.GetSize());
Where.Insert(Pos, With);
Pos += With.GetSize();
}
}
开发者ID:Attnam,项目名称:ivan,代码行数:14,代码来源:festring.cpp
示例7: ExtractWord
void festring::ExtractWord(festring& To)
{
for(sizetype c = 0; c < Size; ++c)
if(Data[c] == ' ')
{
To.Empty();
To.Append(&Data[c + 1], Size - c - 1);
Erase(c, Size - c);
SwapData(To);
return;
}
To = *this;
Empty();
}
开发者ID:jarpiain,项目名称:ivan-tty,代码行数:15,代码来源:festring.cpp
示例8: IgnoreCaseCompare
bool festring::IgnoreCaseCompare(const festring& First,
const festring& Second)
{
for(sizetype Pos = 0;
Pos < First.GetSize() && Pos < Second.GetSize(); ++Pos)
{
char Char1 = ::Capitalize(First[Pos]);
char Char2 = ::Capitalize(Second[Pos]);
if(Char1 != Char2)
return Char1 < Char2;
}
return First.GetSize() < Second.GetSize();
}
开发者ID:jarpiain,项目名称:ivan-tty,代码行数:15,代码来源:festring.cpp
示例9: Reply
void febot::Reply(festring& String) const
{
String.Empty();
if(GetControlWordChain()->Link.empty())
return;
wordchain* WordChain = GetControlWordChain()->GetRandomLink();
String << WordChain->String.back();
for(WordChain = WordChain->GetRandomLink(); !WordChain->String.back().IsEmpty(); WordChain = WordChain->GetRandomLink())
String << ' ' << WordChain->String.back();
String.PostProcessForFebot();
}
开发者ID:eldios,项目名称:ivan,代码行数:15,代码来源:febot.cpp
示例10: BeTalkedTo
void febot::BeTalkedTo(festring String)
{
String.PreProcessForFebot();
if(!String.IsEmpty())
{
festring Word;
wordchain* OldChain = GetControlWordChain();
for(String.ExtractWord(Word); !Word.IsEmpty(); String.ExtractWord(Word))
{
wordchain* NewChain = CreateWordChain(OldChain, Word);
OldChain->Link.push_back(NewChain);
OldChain = NewChain;
}
OldChain->Link.push_back(GetControlWordChain());
}
}
开发者ID:eldios,项目名称:ivan,代码行数:19,代码来源:febot.cpp
示例11: ReadWord
void inputfile::ReadWord(festring& String, truth AbortOnEOF)
{
int Mode = 0;
String.Empty();
for(int Char = fgetc(Buffer); !feof(Buffer); Char = fgetc(Buffer))
{
if(isalpha(Char) || Char == '_')
{
if(!Mode)
Mode = MODE_WORD;
else if(Mode == MODE_NUMBER)
{
ungetc(Char, Buffer);
return;
}
String << char(Char);
continue;
}
if(isdigit(Char))
{
if(!Mode)
Mode = MODE_NUMBER;
else if(Mode == MODE_WORD)
{
ungetc(Char, Buffer);
return;
}
String << char(Char);
continue;
}
if((Char == ' ' || Char == '\n') && Mode)
return;
if(ispunct(Char) && HandlePunct(String, Char, Mode) == PUNCT_RETURN)
return;
}
if(AbortOnEOF)
ABORT("Unexpected end of file %s!", FileName.CStr());
if(Mode)
clearerr(Buffer);
}
开发者ID:jarpiain,项目名称:ivan-tty,代码行数:48,代码来源:save.cpp
示例12: fopen
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
}
}
开发者ID:jarpiain,项目名称:ivan-tty,代码行数:41,代码来源:hscore.cpp
示例13: SplitString
void festring::SplitString(festring& Source,
festring& Result,
sizetype Length)
{
if(Source.GetSize() <= Length)
{
Result << Source;
Source.Empty();
return;
}
sizetype Pos = Source.FindLast(' ', Length);
if(Pos != NPos)
{
Result.Append(Source, Pos);
Source.Erase(0, Pos + 1);
}
else
{
Result.Append(Source, Length);
Source.Erase(0, Length);
}
}
开发者ID:jarpiain,项目名称:ivan-tty,代码行数:24,代码来源:festring.cpp
示例14: HandlePunct
int inputfile::HandlePunct(festring& String, int Char, int Mode)
{
if(Char == '/')
{
if(!feof(Buffer))
{
Char = fgetc(Buffer);
if(Char == '*')
{
long StartPos = TellPos();
int OldChar = 0, CommentLevel = 1;
for(;;)
{
if(feof(Buffer))
ABORT("Unterminated comment in file %s, beginning at line %ld!",
FileName.CStr(), TellLineOfPos(StartPos));
Char = fgetc(Buffer);
if(OldChar != '*' || Char != '/')
{
if(OldChar != '/' || Char != '*')
OldChar = Char;
else
{
++CommentLevel;
OldChar = 0;
}
}
else
{
if(!--CommentLevel)
break;
else
OldChar = 0;
}
}
return PUNCT_CONTINUE;
}
else
{
ungetc(Char, Buffer);
clearerr(Buffer);
}
}
if(Mode)
ungetc('/', Buffer);
else
String << '/';
return PUNCT_RETURN;
}
if(Mode)
{
ungetc(Char, Buffer);
return PUNCT_RETURN;
}
if(Char == '"')
{
long StartPos = TellPos();
int OldChar = 0;
for(;;)
{
if(feof(Buffer))
ABORT("Unterminated string in file %s, beginning at line %ld!",
FileName.CStr(), TellLineOfPos(StartPos));
Char = fgetc(Buffer);
if(Char != '"')
{
String << char(Char);
OldChar = Char;
}
else if(OldChar == '\\')
{
String[String.GetSize() - 1] = '"';
OldChar = 0;
}
else
return PUNCT_RETURN;
}
}
String << char(Char);
return PUNCT_RETURN;
}
开发者ID:jarpiain,项目名称:ivan-tty,代码行数:94,代码来源:save.cpp
示例15: 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;
//.........这里部分代码省略.........
开发者ID:jarpiain,项目名称:ivan-tty,代码行数:101,代码来源:save.cpp
注:本文中的festring类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论