SourceForge.net Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Examples

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-2008
00005  *     Oracle. All rights reserved.
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  * $Id$
00020  */
00021 
00022 #ifndef __INPUTPARSER_HPP
00023 #define __INPUTPARSER_HPP
00024 
00025 #include <vector>
00026 #include <string>
00027 #include <istream>
00028 
00029 #include <xqilla/framework/XQillaExport.hpp>
00030 
00031 class XQILLA_API InputParser
00032 {
00033 public:
00034   typedef std::vector<std::string> Args;
00035 
00036   int parse(std::istream &input, Args &args);
00037 
00038 private:
00039   void reset();
00040   void whitespace(Args &args);
00041   void character();
00042   void escapedCharacter();
00043   bool inQuotes();
00044   void quote(Args &args, char c);
00045   void openCurly();
00046   void closeCurly();
00047   void endOfArg(Args &args);
00048   void addArgument(Args &args, std::string::size_type start, std::string::size_type end);
00049   void nextLine(std::istream &input, Args &args);
00050 
00051   std::string line_;
00052   std::string::size_type start_, pos_;
00053   char quoteChar_;
00054   int curlyBraceDepth_;
00055   bool seenNonWS_;
00056   bool stripQuotes_;
00057 };
00058 
00059 #endif

Generated on Fri Sep 25 06:55:26 2009 for XQilla Simple API by  doxygen 1.3.9.1