# XQilla Simple API Documentation

- Main Page
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

# InputParser.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Copyright (c) 2001, 2008,
    00003  *     DecisionSoft Limited. All rights reserved.
    00004  * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
    00005  *
    00006  *
    00007  * Licensed under the Apache License, Version 2.0 (the "License");
    00008  * you may not use this file except in compliance with the License.
    00009  * You may obtain a copy of the License at
    00010  *
    00011  *     http://www.apache.org/licenses/LICENSE-2.0
    00012  *
    00013  * Unless required by applicable law or agreed to in writing, software
    00014  * distributed under the License is distributed on an "AS IS" BASIS,
    00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00016  * See the License for the specific language governing permissions and
    00017  * limitations under the License.
    00018  */
    00019
    00020 #ifndef __INPUTPARSER_HPP
    00021 #define __INPUTPARSER_HPP
    00022
    00023 #include <vector>
    00024 #include <string>
    00025 #include <istream>
    00026
    00027 #include <xqilla/framework/XQillaExport.hpp>
    00028
    00029 class XQILLA_API InputParser
    00030 {
    00031 public:
    00032   typedef std::vector<std::string> Args;
    00033
    00034   int parse(std::istream &input, Args &args);
    00035
    00036 private:
    00037   void reset();
    00038   void whitespace(Args &args);
    00039   void character();
    00040   void escapedCharacter();
    00041   bool inQuotes();
    00042   void quote(Args &args, char c);
    00043   void openCurly();
    00044   void closeCurly();
    00045   void endOfArg(Args &args);
    00046   void addArgument(Args &args, std::string::size_type start, std::string::size_type end);
    00047   void nextLine(std::istream &input, Args &args);
    00048
    00049   std::string line_;
    00050   std::string::size_type start_, pos_;
    00051   char quoteChar_;
    00052   int curlyBraceDepth_;
    00053   bool seenNonWS_;
    00054   bool stripQuotes_;
    00055 };
    00056
    00057 #endif