本文整理汇总了C++中Stroka类的典型用法代码示例。如果您正苦于以下问题:C++ Stroka类的具体用法?C++ Stroka怎么用?C++ Stroka使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Stroka类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: YASSERT
bool TDependencyCollectorInputStream::TryConsumeImportFileName(const NProtoBuf::io::Tokenizer::Token& token)
{
ImportProcessor.NextState(token);
if (!ImportProcessor.Found())
return false;
YASSERT(token.type == NProtoBuf::io::Tokenizer::TYPE_STRING);
// original imported file (unquoted)
Stroka original;
Tokenizer_.ParseString(token.text, &original);
// canonic file
const Stroka canonic = SourceTree->CanonicName(original);
if (canonic.empty() || canonic == original) {
// make a hint for this special case
if (original == STRINGBUF("base.proto"))
ErrorCollector->AddErrorAtCurrentFile(token.line, token.column,
"Importing base.proto by shortcut name is not allowed from arcadia. You should use full path instead: import \"kernel/gazetteer/base.proto\";");
return false; // just proceed with original file name
}
// restore quotes and replace original with canonic in further pipeline.
CanonicImportedFile.clear();
CanonicImportedFile.append('"');
EscapeC(canonic, CanonicImportedFile);
CanonicImportedFile.append('"');
return true;
}
示例2: Fix
static inline Stroka Fix(Stroka f) {
if (!f.empty() && IsDelim(f[+f - 1])) {
f.pop_back();
}
return f;
}
示例3: WriteFile
void WriteFile(
const char *file,
const vector<vector<double>> &vec,
const char *head,
const char *mes) {
FILE *out = open(file, "w", mes);
if(head) {
Stroka tmp = Stroka(head) + "\n";
fputs(tmp.c_str(), out);
}
if(vec.size() == 0)
return;
char Buf[256];
for(size_t i = 0; i < vec[0].size(); i++) {
for(size_t j = 0; j < vec.size(); j++) {
if(vec[j][i] == NullNumber)
fputs(" \"\" ", out);
else {
sprintf(Buf, "%10.9g ", vec[j][i]);
fputs(Buf, out);
}
}
fputs("\x0d\x0a", out);
}
close(out);
}
示例4: SaveStateCollection
void CLRCollectionSet::SaveStateCollection(Stroka GrammarFileName, const CWorkGrammar* p_WorkGrammar) const
{
if (GrammarFileName.empty()) return;
FILE * fp = fopen(GrammarFileName.c_str(), "wb");
for (int i = 0; i < (int)m_ItemSets.size(); i++) {
fprintf(fp, "I%i =\n", i);
for (yset<CLRItem>::const_iterator it = m_ItemSets[i].begin(); it != m_ItemSets[i].end(); it++) {
fprintf(fp, "\t%s -> ", p_WorkGrammar->m_UniqueGrammarItems[it->m_pRule->m_LeftPart].m_ItemStrId.c_str());
for (int j = 0; j < (int)it->m_pRule->m_RightPart.m_Items.size(); j++) {
if (j == (int)it->m_DotSymbolNo)
fprintf(fp, "; ");
fprintf(fp, "%s ", p_WorkGrammar->m_UniqueGrammarItems[it->m_pRule->m_RightPart.m_Items[j]].m_ItemStrId.c_str());
}
if (it->m_DotSymbolNo == it->m_pRule->m_RightPart.m_Items.size())
fprintf(fp, "; ");
fprintf(fp, "\n");
}
fprintf(fp, "\n");
}
fprintf(fp, "\n");
for (ymap< CStateAndSymbol, size_t>::const_iterator it_goto = m_GotoFunction.begin(); it_goto != m_GotoFunction.end(); it_goto++)
fprintf(fp, "GOTO( I%" PRISZT ", %s ) = I%" PRISZT "\n", it_goto->first.m_StateNo, p_WorkGrammar->m_UniqueGrammarItems[it_goto->first.m_SymbolNo].m_ItemStrId.c_str(), it_goto->second);
fclose(fp);
}
示例5: Init
bool CAgencyInfoRetriver::Init(const Stroka& strDoc2AgFile)
{
if (!strDoc2AgFile.empty() && isexist(strDoc2AgFile.c_str()))
m_DocId2AgNameFile = TFile(strDoc2AgFile.c_str(), OpenExisting | RdOnly);
return true;
}
示例6: StripFileComponent
Stroka StripFileComponent(const Stroka& fileName)
{
Stroka dir = IsDir(fileName) ? fileName : GetDirName(fileName);
if (!dir.empty() && dir.back() != GetDirectorySeparator()) {
dir.append(GetDirectorySeparator());
}
return dir;
}
示例7: PrintItemSet
void PrintItemSet(const CWorkGrammar* pWorkGrammar, const yset<CLRItem>& ItemSet)
{
for (yset<CLRItem>::const_iterator it = ItemSet.begin(); it != ItemSet.end(); it++) {
Stroka s = pWorkGrammar->GetRuleStr(*it->m_pRule, it->m_DotSymbolNo);
printf ("%s\n", s.c_str());
};
};
示例8: QuoteForHelp
// Like Stroka::Quote(), but does not quote digits-only string
static Stroka QuoteForHelp(const Stroka& str) {
if (str.empty())
return str.Quote();
for (size_t i = 0; i < str.size(); ++i) {
if (!isdigit(str[i]))
return str.Quote();
}
return str;
}
示例9: BitsetToString
Stroka BitsetToString(const yvector<TGramBitSet>& bitset, const Stroka& delim /*= ", "*/, const Stroka& groupdelim /*= ", "*/) {
Stroka s;
for (size_t i = 0; i < bitset.size(); ++i) {
if (!s.empty())
s += groupdelim;
s += bitset[i].ToString(~delim);
}
return s;
}
示例10: DebugString
Stroka TFileCollection::DebugString() const {
Stroka ret;
for (size_t i = 0; i < Files.size(); ++i) {
ret.append(Files[i]->Name()).append(" ->");
for (size_t j = 0; j < Files[i]->Aliases().size(); ++j)
ret.append(' ').append(Files[i]->Aliases()[j]);
ret.append('\n');
}
return ret;
}
示例11: Stroka
Stroka CCommonParm::GetOutputFileName() const {
if (NULL != Config.Get() && Config->has_output() && Config->output().has_file()) {
Stroka fn = Config->output().GetFile();
fn.to_lower();
if ("stdout" == fn)
return "-";
return Config->output().GetFile();
}
return Stroka("-");
}
示例12: GetInterviewFio
Wtroka CProcessor::GetInterviewFio(Stroka strUrl) const
{
ymap<Stroka, Wtroka>::const_iterator it = InterviewUrl2Fio.find(strUrl);
if (it != InterviewUrl2Fio.end())
return it->second;
static const Stroka kHTTP = "http://";
if (strUrl.has_prefix(kHTTP)) {
strUrl = strUrl.substr(kHTTP.size());
return GetInterviewFio(strUrl);
}
return Wtroka();
}
示例13: SlashFolderLocal
void SlashFolderLocal(Stroka &folder)
{
if (!folder)
return;
#ifdef _win32_
size_t pos;
while ((pos = folder.find('/')) != Stroka::npos)
folder.replace(pos, 1, LOCSLASH_S);
#endif
if (folder[+folder-1] != LOCSLASH_C)
folder.append(LOCSLASH_S);
}
示例14: TestRaise1
inline void TestRaise1() {
try {
Throw2DontMove();
UNIT_ASSERT(false);
} catch (...) {
Stroka err = CurrentExceptionMessage();
char *ptr = err.begin();
while ((ptr = strchr(ptr, '\\')) != 0)
*ptr = '/';
UNIT_ASSERT_VALUES_EQUAL(err, "util/generic/yexception_ut.cpp:8: 1 qw 12.1");
}
}
示例15: ParseListOfFacts
void CParserOptions::ParseListOfFacts(TXmlNodePtrBase piNode) {
TXmlNodePtrBase piFacts = piNode->children;
m_ParserOutputOptions.m_bShowFactsWithEmptyField = piNode.HasAttr("addEmpty");
for (; piFacts.Get() != NULL; piFacts = piFacts->next) {
if (!piFacts.HasName("fact"))
continue;
Stroka str = piFacts.GetAttr("name");
if (!str.empty())
AddFactToShow(str, !piFacts.HasAttr("noequality"));
}
}