本文整理汇总了C++中parserError函数的典型用法代码示例。如果您正苦于以下问题:C++ parserError函数的具体用法?C++ parserError怎么用?C++ parserError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parserError函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: parserError
bool XMLParser::skipComments() {
if (_char == '<') {
_char = _stream->readByte();
if (_char != '!') {
_stream->seek(-1, SEEK_CUR);
_char = '<';
return false;
}
if (_stream->readByte() != '-' || _stream->readByte() != '-')
return parserError("Malformed comment syntax.");
_char = _stream->readByte();
while (_char) {
if (_char == '-') {
if (_stream->readByte() == '-') {
if (_stream->readByte() != '>')
return parserError("Malformed comment (double-hyphen inside comment body).");
_char = _stream->readByte();
return true;
}
}
_char = _stream->readByte();
}
return parserError("Comment has no closure.");
}
return false;
}
开发者ID:MatChung,项目名称:scummvm-ps3,代码行数:35,代码来源:xmlparser.cpp
示例2: parserError
bool VirtualKeyboardParser::parserCallback_area(ParserNode *node) {
String &shape = node->values["shape"];
String &target = node->values["target"];
String &coords = node->values["coords"];
if (target.equalsIgnoreCase("display_area")) {
if (!shape.equalsIgnoreCase("rect"))
return parserError("display_area must be a rect area");
_mode->displayArea = Rect();
return parseRect(_mode->displayArea, coords);
} else if (shape.equalsIgnoreCase("rect")) {
Polygon *poly = _mode->imageMap.createArea(target);
if (!poly)
return parserError(Common::String::format("Cannot define area '%s' again", target.c_str()));
else
return parseRectAsPolygon(*poly, coords);
} else if (shape.equalsIgnoreCase("poly")) {
Polygon *poly = _mode->imageMap.createArea(target);
if (!poly)
return parserError(Common::String::format("Cannot define area '%s' again", target.c_str()));
else
return parsePolygon(*poly, coords);
}
return parserError("Area shape '" + shape + "' not known");
}
开发者ID:Bundesdrucker,项目名称:scummvm,代码行数:25,代码来源:virtual-keyboard-parser.cpp
示例3: parserError
bool ThemeParser::parserCallback_dialog(ParserNode *node) {
Common::String var = "Dialog." + node->values["name"];
bool enabled = true;
int inset = 0;
if (resolutionCheck(node->values["resolution"]) == false) {
node->ignore = true;
return true;
}
if (node->values.contains("enabled")) {
if (!Common::parseBool(node->values["enabled"], enabled))
return parserError("Invalid value for Dialog enabling (expecting true/false)");
}
if (node->values.contains("inset")) {
if (!parseIntegerKey(node->values["inset"], 1, &inset))
return false;
}
_theme->getEvaluator()->addDialog(var, node->values["overlays"], enabled, inset);
if (node->values.contains("shading")) {
int shading = 0;
if (node->values["shading"] == "dim")
shading = 1;
else if (node->values["shading"] == "luminance")
shading = 2;
else return parserError("Invalid value for Dialog background shading.");
_theme->getEvaluator()->setVar(var + ".Shading", shading);
}
return true;
}
开发者ID:megaboy,项目名称:scummvm,代码行数:35,代码来源:ThemeParser.cpp
示例4: if
bool ThemeParser::parserCallback_drawdata(ParserNode *node) {
bool cached = false;
if (resolutionCheck(node->values["resolution"]) == false) {
node->ignore = true;
return true;
}
if (node->values.contains("cache")) {
if (node->values["cache"] == "true")
cached = true;
else if (node->values["cache"] == "false")
cached = false;
else return parserError("'Parsed' value must be either true or false.");
}
if (_theme->addDrawData(node->values["id"], cached) == false)
return parserError("Error adding Draw Data set: Invalid DrawData name.");
if (_defaultStepLocal) {
delete _defaultStepLocal;
_defaultStepLocal = 0;
}
return true;
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:26,代码来源:ThemeParser.cpp
示例5: parserError
bool ThemeParser::parserCallback_widget(ParserNode *node) {
Common::String var;
if (getParentNode(node)->name == "globals") {
if (resolutionCheck(node->values["resolution"]) == false) {
node->ignore = true;
return true;
}
var = "Globals." + node->values["name"] + ".";
if (!parseCommonLayoutProps(node, var))
return parserError("Error parsing Layout properties of '%s'.", var.c_str());
} else {
// FIXME: Shouldn't we distinguish the name/id and the label of a widget?
var = node->values["name"];
int width = -1;
int height = -1;
bool enabled = true;
if (node->values.contains("enabled")) {
if (node->values["enabled"] == "false")
enabled = false;
else if (node->values["enabled"] != "true")
return parserError("Invalid value for Widget enabling (expecting true/false)");
}
if (node->values.contains("width")) {
if (_theme->getEvaluator()->hasVar(node->values["width"]) == true)
width = _theme->getEvaluator()->getVar(node->values["width"]);
else if (!parseIntegerKey(node->values["width"].c_str(), 1, &width))
return parserError("Corrupted width value in key for %s", var.c_str());
}
if (node->values.contains("height")) {
if (_theme->getEvaluator()->hasVar(node->values["height"]) == true)
height = _theme->getEvaluator()->getVar(node->values["height"]);
else if (!parseIntegerKey(node->values["height"].c_str(), 1, &height))
return parserError("Corrupted height value in key for %s", var.c_str());
}
Graphics::TextAlign alignH = Graphics::kTextAlignLeft;
if (node->values.contains("textalign")) {
if((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid)
return parserError("Invalid value for text alignment.");
}
_theme->getEvaluator()->addWidget(var, width, height, node->values["type"], enabled, alignH);
}
return true;
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:56,代码来源:ThemeParser.cpp
示例6: assert
bool XMLParser::parseActiveKey(bool closed) {
bool ignore = false;
assert(_activeKey.empty() == false);
ParserNode *key = _activeKey.top();
if (key->name == "xml" && key->header == true) {
assert(closed);
return parseXMLHeader(key) && closeKey();
}
XMLKeyLayout *layout = (_activeKey.size() == 1) ? _XMLkeys : getParentNode(key)->layout;
if (layout->children.contains(key->name)) {
key->layout = layout->children[key->name];
Common::StringMap localMap = key->values;
int keyCount = localMap.size();
for (Common::List<XMLKeyLayout::XMLKeyProperty>::const_iterator i = key->layout->properties.begin(); i != key->layout->properties.end(); ++i) {
if (i->required && !localMap.contains(i->name))
return parserError("Missing required property '%s' inside key '%s'", i->name.c_str(), key->name.c_str());
else if (localMap.contains(i->name))
keyCount--;
}
if (keyCount > 0)
return parserError("Unhandled property inside key '%s'.", key->name.c_str());
} else {
return parserError("Unexpected key in the active scope ('%s').", key->name.c_str());
}
// check if any of the parents must be ignored.
// if a parent is ignored, all children are too.
for (int i = _activeKey.size() - 1; i >= 0; --i) {
if (_activeKey[i]->ignore)
ignore = true;
}
if (ignore == false && keyCallback(key) == false) {
// HACK: People may be stupid and overlook the fact that
// when keyCallback() fails, a parserError() must be set.
// We set it manually in that case.
if (_state != kParserError)
parserError("Unhandled exception when parsing '%s' key.", key->name.c_str());
return false;
}
if (closed)
return closeKey();
return true;
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:55,代码来源:xmlparser.cpp
示例7: parserError
bool VirtualKeyboardParser::parseRect(Rect &rect, const String& coords) {
int x1, y1, x2, y2;
if (!parseIntegerKey(coords, 4, &x1, &y1, &x2, &y2))
return parserError("Invalid coords for rect area");
rect.left = x1;
rect.top = y1;
rect.right = x2;
rect.bottom = y2;
if (!rect.isValidRect())
return parserError("Rect area is not a valid rectangle");
return true;
}
开发者ID:MatChung,项目名称:scummvm-ps3,代码行数:12,代码来源:virtual-keyboard-parser.cpp
示例8: assert
bool VirtualKeyboardParser::parserCallback_layout(ParserNode *node) {
assert(!_mode->resolution.empty());
String res = node->values["resolution"];
if (res != _mode->resolution) {
node->ignore = true;
return true;
}
_mode->bitmapName = node->values["bitmap"];
SeekableReadStream *file = _keyboard->_fileArchive->createReadStreamForMember(_mode->bitmapName);
if (!file)
return parserError("Bitmap '" + _mode->bitmapName + "' not found");
const Graphics::PixelFormat format = g_system->getOverlayFormat();
{
Graphics::BitmapDecoder bmp;
if (!bmp.loadStream(*file))
return parserError("Error loading bitmap '" + _mode->bitmapName + "'");
_mode->image = bmp.getSurface()->convertTo(format);
}
delete file;
int r, g, b;
if (node->values.contains("transparent_color")) {
if (!parseIntegerKey(node->values["transparent_color"], 3, &r, &g, &b))
return parserError("Could not parse color value");
} else {
// default to purple
r = 255;
g = 0;
b = 255;
}
_mode->transparentColor = format.RGBToColor(r, g, b);
if (node->values.contains("display_font_color")) {
if (!parseIntegerKey(node->values["display_font_color"], 3, &r, &g, &b))
return parserError("Could not parse color value");
} else {
r = g = b = 0; // default to black
}
_mode->displayFontColor = format.RGBToColor(r, g, b);
_layoutParsed = true;
return true;
}
开发者ID:Bundesdrucker,项目名称:scummvm,代码行数:52,代码来源:virtual-keyboard-parser.cpp
示例9: tok
bool VirtualKeyboardParser::parsePolygon(Polygon &poly, const String& coords) {
StringTokenizer tok(coords, ", ");
for (String st = tok.nextToken(); !st.empty(); st = tok.nextToken()) {
int x, y;
if (sscanf(st.c_str(), "%d", &x) != 1)
return parserError("Invalid coords for polygon area");
st = tok.nextToken();
if (sscanf(st.c_str(), "%d", &y) != 1)
return parserError("Invalid coords for polygon area");
poly.addPoint(x, y);
}
if (poly.getPointCount() < 3)
return parserError("Invalid coords for polygon area");
return true;
}
开发者ID:MatChung,项目名称:scummvm-ps3,代码行数:16,代码来源:virtual-keyboard-parser.cpp
示例10: readArff
//Note: could possibly use Waffles arff parser
//http://waffles.sourceforge.net/docs/matrices.html
StructuredSampleCollection readArff(std::istream& in){
unsigned lineNum = 0;
std::string relationName;
std::vector<std::string> contvarNames;
std::vector<std::string> catvarNames;
//std::vector<std::string> binvarNames;
std::vector<Array<std::string> > catvarCatNames;
//std::vector<Array<std::string> > binvarCatNames;
std::vector<featurety_t> featureTypes; //Used to determine the order of the arff arguments.
std::string line;
while (1)
{
lineNum++;
if(!std::getline(in, line)){
parserError(lineNum) << "Blank or absent @DATA section." << std::endl;
exit(1);
}
//Filter comments, blank lines
if(line.length() == 0 || line[0] == '%') continue;
std::istringstream lineStream(line);
//Read from the line
std::string token;
lineStream >> token;
tolower(token);
if(token == "@relation"){
lineStream >> relationName;
}
else if(token == "@attribute"){
开发者ID:bfisch02,项目名称:csax_cpp,代码行数:37,代码来源:io.cpp
示例11: parseTextColorId
bool ThemeParser::parserCallback_text_color(ParserNode *node) {
int red, green, blue;
TextColor colorId = parseTextColorId(node->values["id"]);
if (colorId == kTextColorMAX)
return parserError("Error text color is not defined.");
if (_palette.contains(node->values["color"]))
getPaletteColor(node->values["color"], red, green, blue);
else if (!parseIntegerKey(node->values["color"], 3, &red, &green, &blue))
return parserError("Error parsing color value for text color definition.");
if (!_theme->addTextColor(colorId, red, green, blue))
return parserError("Error while adding text color information.");
return true;
}
开发者ID:megaboy,项目名称:scummvm,代码行数:17,代码来源:ThemeParser.cpp
示例12: TCInfo
void TCParser::_parserError(tcrec_error error, const char *info)
{
TCInfo *err = new TCInfo(tcinfo_error, error, info);
parserError(err);
err->release();
}
开发者ID:chroniX0,项目名称:torchat-mac,代码行数:8,代码来源:TCParser.cpp
示例13: getPaletteColor
bool ThemeParser::parserCallback_font(ParserNode *node) {
int red, green, blue;
if (resolutionCheck(node->values["resolution"]) == false) {
node->ignore = true;
return true;
}
if (_palette.contains(node->values["color"]))
getPaletteColor(node->values["color"], red, green, blue);
else if (!parseIntegerKey(node->values["color"].c_str(), 3, &red, &green, &blue))
return parserError("Error parsing color value for font definition.");
TextData textDataId = parseTextDataId(node->values["id"]);
if (!_theme->addFont(textDataId, node->values["file"], red, green, blue))
return parserError("Error loading Font in theme engine.");
return true;
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:19,代码来源:ThemeParser.cpp
示例14: parseTextDataId
bool ThemeParser::parserCallback_font(ParserNode *node) {
if (resolutionCheck(node->values["resolution"]) == false) {
node->ignore = true;
return true;
}
TextData textDataId = parseTextDataId(node->values["id"]);
if (!_theme->addFont(textDataId, node->values["file"]))
return parserError("Error loading Font in theme engine.");
return true;
}
开发者ID:megaboy,项目名称:scummvm,代码行数:12,代码来源:ThemeParser.cpp
示例15: Map_Prio
prio_t
Map_Prio (const String & s)
{
if (s == "system")
return PRIO_SYSTEM;
if (s == "urgent")
return PRIO_URGENT;
if (s == "normal")
return PRIO_NORMAL;
if (s == "low")
return PRIO_LOW;
parserError (_("unkown Priority %s"), s ());
}
开发者ID:AdrienCourtois,项目名称:Domoleaf,代码行数:13,代码来源:map.cpp
示例16: getParentNode
bool ThemeParser::parserCallback_defaults(ParserNode *node) {
ParserNode *parentNode = getParentNode(node);
Graphics::DrawStep *step = 0;
if (parentNode->name == "render_info") {
step = _defaultStepGlobal;
} else if (parentNode->name == "drawdata") {
if (_defaultStepLocal == 0)
_defaultStepLocal = new Graphics::DrawStep(*_defaultStepGlobal);
step = _defaultStepLocal;
} else {
return parserError("<default> key out of scope. Must be inside <drawdata> or <render_info> keys.");
}
return parseDrawStep(node, step, false);
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:17,代码来源:ThemeParser.cpp
示例17: newDrawStep
bool ThemeParser::parserCallback_drawstep(ParserNode *node) {
Graphics::DrawStep *drawstep = newDrawStep();
Common::String functionName = node->values["func"];
drawstep->drawingCall = getDrawingFunctionCallback(functionName);
if (drawstep->drawingCall == 0)
return parserError("%s is not a valid drawing function name", functionName.c_str());
if (!parseDrawStep(node, drawstep, true))
return false;
_theme->addDrawStep(getParentNode(node)->values["id"], *drawstep);
delete drawstep;
return true;
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:18,代码来源:ThemeParser.cpp
示例18: parseFiles
int parseFiles(int argc, char *argv[], graph * map, company ** cmp) {
int i = 0;
int ret = 0;
if (argc < 3)
return parserError(NULL, NULL, INVALID_ARGUMENTS, NULL);
if ((ret = openAndReadCityFile(argv[1], map)) != EXIT_SUCCESS
)
return ret;
for (i = 0; i < argc - 2; i++) {
cmp[i] = NULL;
}
for (i = 2; i < argc; ++i) {
if ((ret = openAndReadCompanyFile(argv[i], cmp, i - 2, map))
!= EXIT_SUCCESS
)
return ret;
}
return EXIT_SUCCESS;
}
开发者ID:epintos,项目名称:os-p1,代码行数:19,代码来源:simulation.c
注:本文中的parserError函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论