Files
IfcOpenShell/src/ifcparse/IfcParse.h
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

87 lines
3.4 KiB
C++
Raw Normal View History

/********************************************************************************
2023-09-18 16:13:44 +02:00
* *
* This file is part of IfcOpenShell. *
* *
* IfcOpenShell is free software: you can redistribute it and/or modify *
* it under the terms of the Lesser GNU General Public License as published by *
* the Free Software Foundation, either version 3.0 of the License, or *
* (at your option) any later version. *
* *
* IfcOpenShell is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* Lesser GNU General Public License for more details. *
* *
* You should have received a copy of the Lesser GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
2011-05-08 11:04:32 +00:00
/********************************************************************************
* *
* This file provides functions for loading an IFC file into memory and access *
* its entities either by ID, by an IfcSchema::Type or by reference *
* *
********************************************************************************/
2011-05-08 11:04:32 +00:00
#ifndef IFCPARSE_H
#define IFCPARSE_H
2023-09-17 12:30:17 +02:00
#include "Argument.h"
#include "ifc_parse_api.h"
#include "express.h"
2023-09-17 12:30:17 +02:00
#include "IfcCharacterDecoder.h"
2025-10-13 20:47:43 +02:00
#include "FileReader.h"
#include "macros.h"
#include "storage.h"
2023-09-17 12:30:17 +02:00
#include <boost/dynamic_bitset.hpp>
#include <boost/shared_ptr.hpp>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
2011-05-08 11:04:32 +00:00
extern const char *IFCOPENSHELL_VERSION;
2011-05-08 11:04:32 +00:00
namespace IfcParse {
2025-10-13 20:47:43 +02:00
/// A stream of tokens to be read from a FileReader.
2023-09-17 12:30:17 +02:00
class IFC_PARSE_API IfcSpfLexer {
private:
IfcCharacterDecoder* decoder_;
2025-10-13 20:47:43 +02:00
size_t skipWhitespace() const;
size_t skipComment() const;
2023-09-17 12:30:17 +02:00
mutable std::vector<std::unique_ptr<std::array<std::string, 16>>> stringpool_;
mutable size_t pool_index = 0;
2023-09-17 12:30:17 +02:00
public:
std::string& getTempString() const;
void resetPool() const {
pool_index = 0;
2023-09-17 12:30:17 +02:00
}
void popPoolEntry() {
if (pool_index > 0) {
--pool_index;
}
}
2025-10-13 20:47:43 +02:00
FileReader* stream;
// IfcFile* file;
2025-10-13 20:47:43 +02:00
IfcSpfLexer(FileReader* stream);
2023-09-17 12:30:17 +02:00
Token Next();
~IfcSpfLexer();
// void TokenString(size_t offset, std::string& result);
2023-09-17 12:30:17 +02:00
};
IFC_PARSE_API std::vector<express::Base> traverse(const express::Base& instance, int max_level = -1);
2023-09-17 12:30:17 +02:00
IFC_PARSE_API std::vector<express::Base> traverse_breadth_first(const express::Base& instance, int max_level = -1);
2023-09-17 12:30:17 +02:00
} // namespace IfcParse
IFC_PARSE_API std::ostream& operator<<(std::ostream& out, const IfcParse::IfcFile& file);
2011-05-08 11:04:32 +00:00
#endif