diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2014-12-03 23:40:37 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2014-12-03 23:40:37 +0800 |
commit | d25581de7cc89470a060625c043dba8cf9ae293f (patch) | |
tree | fd5aae1d54b8d07ebd208acb0eb4c4d6e8c8c499 /CompilerStack.h | |
parent | be81981ec4a3a9e7704b230096d9a580175d759e (diff) | |
download | dexon-solidity-d25581de7cc89470a060625c043dba8cf9ae293f.tar.gz dexon-solidity-d25581de7cc89470a060625c043dba8cf9ae293f.tar.zst dexon-solidity-d25581de7cc89470a060625c043dba8cf9ae293f.zip |
Moving all Interface and Documentation functionality to own class
- Creating the Interface Handler class which will take care of the
parsing of Natspec comments and of interfacing with and outputing to
JSON files.
- Will also handle the ABI interface creation
Diffstat (limited to 'CompilerStack.h')
-rw-r--r-- | CompilerStack.h | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/CompilerStack.h b/CompilerStack.h index 4e0d2251..7dc86e2b 100644 --- a/CompilerStack.h +++ b/CompilerStack.h @@ -35,6 +35,14 @@ class Scanner; class ContractDefinition; class Compiler; class GlobalContext; +class InterfaceHandler; + +enum documentation_type : unsigned short +{ + NATSPEC_USER = 1, + NATSPEC_DEV, + ABI_INTERFACE +}; /** * Easy to use and self-contained Solidity compiler with as few header dependencies as possible. @@ -44,7 +52,7 @@ class GlobalContext; class CompilerStack { public: - CompilerStack() {} + CompilerStack(); void reset() { *this = CompilerStack(); } void setSource(std::string const& _sourceCode); void parse(); @@ -62,12 +70,11 @@ public: /// Returns a string representing the contract interface in JSON. /// Prerequisite: Successful call to parse or compile. std::string const& getInterface(); - /// Returns a string representing the contract's user documentation in JSON. - /// Prerequisite: Successful call to parse or compile. - std::string const& getUserDocumentation(); - /// Returns a string representing the contract's developer documentation in JSON. + /// Returns a string representing the contract's documentation in JSON. /// Prerequisite: Successful call to parse or compile. - std::string const& getDevDocumentation(); + /// @param type The type of the documentation to get. + /// Can be one of 3 types defined at @c documentation_type + std::string const* getJsonDocumentation(enum documentation_type type); /// Returns the previously used scanner, useful for counting lines during error reporting. Scanner const& getScanner() const { return *m_scanner; } @@ -82,10 +89,11 @@ private: std::shared_ptr<GlobalContext> m_globalContext; std::shared_ptr<ContractDefinition> m_contractASTNode; bool m_parseSuccessful; - std::string m_interface; - std::string m_userDocumentation; - std::string m_devDocumentation; + std::unique_ptr<std::string> m_interface; + std::unique_ptr<std::string> m_userDocumentation; + std::unique_ptr<std::string> m_devDocumentation; std::shared_ptr<Compiler> m_compiler; + std::shared_ptr<InterfaceHandler> m_interfaceHandler; bytes m_bytecode; }; |