1 /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2 * Use of this file is governed by the BSD 3-clause license that
3 * can be found in the LICENSE.txt file in the project root.
8 #include "ANTLRInputStream.h"
12 /// This is an ANTLRInputStream that is loaded from a file all at once
13 /// when you construct the object (or call load()).
14 // TODO: this class needs testing.
15 class ANTLR4CPP_PUBLIC ANTLRFileStream : public ANTLRInputStream {
17 ANTLRFileStream() = default;
18 ANTLRFileStream(const std::string &) = delete;
19 ANTLRFileStream(const char *data, size_t length) = delete;
20 ANTLRFileStream(std::istream &stream) = delete;
22 // Assumes a file name encoded in UTF-8 and file content in the same encoding (with or w/o BOM).
23 virtual void loadFromFile(const std::string &fileName);
24 virtual std::string getSourceName() const override;
27 std::string _fileName; // UTF-8 encoded file name.