michael@0: // michael@0: // Copyright (c) 2011 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: #ifndef COMPILER_PREPROCESSOR_INPUT_H_ michael@0: #define COMPILER_PREPROCESSOR_INPUT_H_ michael@0: michael@0: #include michael@0: #include michael@0: michael@0: namespace pp michael@0: { michael@0: michael@0: // Holds and reads input for Lexer. michael@0: class Input michael@0: { michael@0: public: michael@0: Input(); michael@0: Input(size_t count, const char* const string[], const int length[]); michael@0: michael@0: size_t count() const { return mCount; } michael@0: const char* string(size_t index) const { return mString[index]; } michael@0: size_t length(size_t index) const { return mLength[index]; } michael@0: michael@0: size_t read(char* buf, size_t maxSize); michael@0: michael@0: struct Location michael@0: { michael@0: size_t sIndex; // String index; michael@0: size_t cIndex; // Char index. michael@0: michael@0: Location() : sIndex(0), cIndex(0) { } michael@0: }; michael@0: const Location& readLoc() const { return mReadLoc; } michael@0: michael@0: private: michael@0: // Input. michael@0: size_t mCount; michael@0: const char* const* mString; michael@0: std::vector mLength; michael@0: michael@0: Location mReadLoc; michael@0: }; michael@0: michael@0: } // namespace pp michael@0: #endif // COMPILER_PREPROCESSOR_INPUT_H_ michael@0: