0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Token.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
26 
27 #ifndef Common_ClusterDefinition_Token_h
28 #define Common_ClusterDefinition_Token_h
29 
30 #include "Translator.h"
31 
32 #include <memory>
33 #include <string>
34 
35 namespace Hypertable { namespace ClusterDefinitionFile {
36 
37  using namespace std;
38 
41 
43  class Token {
44  public:
46  enum Type {
47  NONE=0,
50  ROLE,
51  TASK,
55  CODE,
56  BLANKLINE
57  };
58 
60  void clear() { type=NONE; text.clear(); line=0; fname.clear(); }
61 
65  void create_translator();
66 
70  static const char *type_to_text(int type);
71 
73  int type {NONE};
77  string text;
79  size_t line {};
81  string fname;
82  };
83 
85 
86 }}
87 
88 #endif // Common_ClusterDefinition_Token_h
Type
Enumeration for token types.
Definition: Token.h:46
TranslatorPtr translator
Translator object for token text.
Definition: Token.h:75
shared_ptr< Translator > TranslatorPtr
Smart pointer to Translator.
Definition: Translator.h:54
Declarations for Translator.
string fname
Pathname of file from which token was extracted.
Definition: Token.h:81
STL namespace.
Cluster definition file token.
Definition: Token.h:43
void clear()
Clears token state.
Definition: Token.h:60
Hypertable definitions