This file is indexed.

/usr/include/choreonoid-1.1/cnoid/src/Util/EasyScanner.h is in libcnoid-dev 1.1.0+dfsg-6.1+b4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/*! @file
  @brief The header file of a text scanner class
  @author Shin'ichiro Nakaoka
*/

#ifndef CNOID_UTIL_EASYSCANNER_H_INCLUDED
#define CNOID_UTIL_EASYSCANNER_H_INCLUDED

#include <map>
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include "exportdecl.h"

namespace cnoid {

    /**
       @todo introduce a pimpl to hide the use of map, vector
    */
    class CNOID_EXPORT  EasyScanner {

    public:

        class Endl {
            //int dummy;
        };

        class CNOID_EXPORT Exception {
        public:
            std::string message;
            std::string filename;
            int lineNumber;
            std::string getFullMessage();
        };

        enum TokenType {
            T_NONE = 0, T_SPACE, T_ALPHABET, T_INTEGER, T_DOUBLE, T_WORD,
            T_STRING, T_SIGLUM, T_LF, T_EOF
        };

        typedef std::map<std::string, int> SymbolMap;
        typedef std::pair<std::string, int> SymbolPair;
        typedef boost::shared_ptr<SymbolMap> SymbolMapPtr;

        Endl endl;

        EasyScanner();
        EasyScanner(std::string filename);
        EasyScanner(const EasyScanner& scanner, bool copy_text = false);
        virtual ~EasyScanner();

        void putSymbols();

        inline void registerSymbol(int id, const std::string& symbol) {
            symbols->insert(SymbolPair(symbol, id));
        }

        inline int  getSymbolID(const std::string& symbol) {
            SymbolMap::iterator p = symbols->find(symbol);
            return (p != symbols->end()) ? p->second : 0;
        }

        /// if 0, comment is disabled
        void setCommentChar(char cc);

        void setLineOriented(bool on);
        void setQuoteChar(char qc);
        void setWhiteSpaceChar(char ws);

        void loadFile(const std::string& filename);

        void setText(const char* text, int len);

        void setLineNumberOffset(int offset);

        void setDefaultErrorMessage(const std::string& message){
            defaultErrorMessage = message;
        }

        void moveToHead();

        int  readToken();

        void toLower();

        bool readDouble();
        bool readInt();
        bool readChar();
        bool readChar(int chara);
        int  peekChar();

        /**
           In contrast to readString(),
           this function does not recognize siglums except '_' as a part of a word.
        */
        inline bool readWord() {
            skipSpace();
            return readWord0();
        }

        /**
           In contrast to readWord(),
           this function allows a string to include siglums such as !,",#,$,%,&,...
        */
        inline bool readString(const int delimiterChar = ',') {
            skipSpace();
            return readString0(delimiterChar);
        }

        bool readString(const char* str);

        inline bool readString(const std::string& str) {
            return readString(str.c_str());
        }

        bool readQuotedString(bool allowNoQuotedWord = false);

        bool readUnquotedTextBlock();

        bool readSymbol();
        bool readSymbol(int id);

        inline bool isEOF(){
            skipSpace();
            return (*text == '\0');
        }

        /// reading a line feed
        inline bool readLF() {
            skipSpace();
            return readLF0();
        }

        inline bool readLFEOF() {
            skipSpace();
            return readLF0() ? true : (*text == '\0');
        }

        bool checkLF();

        bool readLine();
        bool skipLine();
        bool skipBlankLines();

        void skipSpace();

        void throwException(const char* message);
        void throwException(const std::string& message);

        /**
           The exception version of readInt().
           \return Scanned int value.
        */
        inline int readIntEx(const char* message = 0) {
            if(!readInt()) throwException(message);
            return intValue;
        }
        /**
           The exception version of readDouble().
           \return Scanned double value.
        */
        inline double readDoubleEx(const char* message = 0) {
            if(!readDouble()) throwException(message);
            return doubleValue;
        }
        /**
           The exception version of readChar().
           \return Scanned char value.
        */
        inline int readCharEx(const char* message = 0) {
            if(!readChar())
                throwException(message);
            return charValue;
        }
        /**
           The exception version of readChar().
        */
        inline void readCharEx(int chara, const char* message = 0) {
            if(!readChar(chara)) throwException(message);
        }
        /**
           The exception version of readWord().
           \return Scanned word string.
        */
        inline std::string readWordEx(const char* message = 0) {
            if(!readWord()) throwException(message);
            return stringValue;
        }

        /**
           The exception version of readString().
           \return Scanned word string.
        */
        inline std::string readStringEx(const char* message = 0) {
            if(!readString()) throwException(message);
            return stringValue;
        }

        inline std::string readQuotedStringEx(const char* message = 0) {
            if(!readQuotedString()) throwException(message);
            return stringValue;
        }
        /**
           The exception version of readSymbol().
           \return ID of the scanned symbol.
        */
        inline int readSymbolEx(const char* message = 0) {
            if(!readSymbol()) throwException(message);
            return symbolValue;
        }
        /**
           The exception version of readLF().
        */
        inline void readLFex(const char* message = 0) {
            if(!readLF()) throwException(message);
        }

        inline void readLFEOFex(const char* message = 0) {
            if(!readLFEOF()) throwException(message);
        }

        int intValue;
        double doubleValue;
        std::string stringValue;
        char charValue;
        int symbolValue;

        std::string defaultErrorMessage;
        int lineNumber;

        char* text;

        std::string filename;

    private:
        void init();
        bool extractQuotedString();

        inline void skipToLineEnd();
        bool readLF0();
        bool readWord0();
        bool readString0(const int delimiterChar);
    
        char* textBuf;
        int size;
        char* textBufEnd;
        int lineNumberOffset;
        int commentChar;
        int quoteChar;
        bool isLineOriented;

        std::vector<int> whiteSpaceChars;

        SymbolMapPtr symbols;

        friend CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, double& value);
        friend CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, int& value);
        friend CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, const char* matchString);
        friend CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, char matchChar);
        friend CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, std::string& str);
        friend CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, EasyScanner::Endl endl);

    };


    CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, double& value);
    CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, int& value);
    CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, const char* matchString);
    CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, char matchChar);
    CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, std::string& str);
    CNOID_EXPORT EasyScanner& operator>>(EasyScanner& scanner, EasyScanner::Endl endl);

    typedef boost::shared_ptr<EasyScanner> EasyScannerPtr;

}

#endif