本文整理汇总了C++中MemoryStream::SeekFromBegin方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryStream::SeekFromBegin方法的具体用法?C++ MemoryStream::SeekFromBegin怎么用?C++ MemoryStream::SeekFromBegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryStream
的用法示例。
在下文中一共展示了MemoryStream::SeekFromBegin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
Console::WriteLine(L"error> Cannot open \""+inputPath+L" for read.");
Console::SetColor(false, true, false, true);
goto STOP_PARSING;
}
BomDecoder decoder;
DecoderStream decoderStream(fileStream, decoder);
StreamReader reader(decoderStream);
if(!config.ReadConfig(reader))
{
goto STOP_PARSING;
}
codeGrammar=reader.ReadToEnd();
}
Ptr<ParsingDefinition> definition;
Ptr<ParsingTable> table;
{
FileStream fileStream(logPath, FileStream::WriteOnly);
if(!fileStream.IsAvailable())
{
Console::SetColor(true, false, false, true);
Console::WriteLine(L"error> Cannot open \""+logPath+L" for write.");
Console::SetColor(false, true, false, true);
goto STOP_PARSING;
}
BomEncoder encoder(BomEncoder::Utf16);
EncoderStream encoderStream(fileStream, encoder);
StreamWriter writer(encoderStream);
if(codeGrammar==L"<bootstrap-grammar>")
{
definition=CreateParserDefinition();
MemoryStream bootstrapStream;
{
StreamWriter bootstrapWriter(bootstrapStream);
Log(definition, bootstrapWriter);
}
bootstrapStream.SeekFromBegin(0);
StreamReader bootstrapReader(bootstrapStream);
codeGrammar=bootstrapReader.ReadToEnd();
}
else
{
definition=CreateDefinition(parser, codeGrammar, writer);
}
if(!definition)
{
Console::SetColor(true, false, false, true);
Console::WriteLine(L"error> Error happened. Open \""+logPath+L" for details.");
Console::SetColor(false, true, false, true);
goto STOP_PARSING;
}
table=CreateTable(definition, writer, config.ambiguity);
if(!table)
{
Console::SetColor(true, false, false, true);
Console::WriteLine(L"error> Error happened. Open \""+logPath+L" for details.");
Console::SetColor(false, true, false, true);
goto STOP_PARSING;
}
}
{
FileStream fileStream(outputHeaderPath, FileStream::WriteOnly);
if(!fileStream.IsAvailable())
{
Console::SetColor(true, false, false, true);
Console::WriteLine(L"error> Cannot open \""+outputHeaderPath+L" for write.");
Console::SetColor(false, true, false, true);
goto STOP_PARSING;
}
BomEncoder encoder(BomEncoder::Mbcs);
EncoderStream encoderStream(fileStream, encoder);
StreamWriter writer(encoderStream);
WriteHeaderFile(name, definition, table, config, writer);
}
{
FileStream fileStream(outputCppPath, FileStream::WriteOnly);
if(!fileStream.IsAvailable())
{
Console::SetColor(true, false, false, true);
Console::WriteLine(L"error> Cannot open \""+outputCppPath+L" for write.");
Console::SetColor(false, true, false, true);
goto STOP_PARSING;
}
BomEncoder encoder(BomEncoder::Mbcs);
EncoderStream encoderStream(fileStream, encoder);
StreamWriter writer(encoderStream);
config.includes.Clear();
config.includes.Add(L"\""+name+L".h\"");
WriteCppFile(name, codeGrammar, definition, table, config, writer);
}
}
STOP_PARSING:;
}
Console::WriteLine(L"Finished!");
return 0;
}