/* This file is part of solidity. solidity is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. solidity 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 GNU General Public License for more details. You should have received a copy of the GNU General Public License along with solidity. If not, see . */ #pragma once #include #include #include #include #include namespace solidity::frontend { class JsonInterfaceImporter { public: JsonInterfaceImporter(int64_t _nextId): m_nextId{ _nextId } {} ASTPointer importInterfaceAsSourceUnit( langutil::SourceLocation const& _location, std::optional const& _licenseString, std::string const& _name, Json::Value const& _source ); ASTPointer importInterface( langutil::SourceLocation const& _location, std::string const& _name, Json::Value const& _source ); private: ASTPointer createMember( langutil::SourceLocation const& _location, Json::Value const& _node ); ASTPointer createFunction( langutil::SourceLocation const& _location, Json::Value const& _node ); ASTPointer createEvent( langutil::SourceLocation const& _location, Json::Value const& _node ); ASTPointer createParameters( langutil::SourceLocation const& _location, bool _indexed, Json::Value const& _node ); ASTPointer createParameter( langutil::SourceLocation const& _location, bool _indexed, Json::Value const& _node ); private: // helper functions (TODO: that could be shared with ASTJsonImporter) StateMutability stateMutability(Json::Value const& _node) const; Json::Value member(Json::Value const& _node, std::string const& _name) const; template ASTPointer createASTNode( langutil::SourceLocation const& _location, Args&&... _args ); private: int64_t m_nextId; }; } // end namespace