6 #include <QRegularExpression> 9 #define paternUint "^[0-9]{1,77}$" 10 #define paternInt "^\\-{0,1}[0-9]{1,76}$" 11 #define paternAddress "^[a-fA-F0-9]{40,40}$" 12 #define paternBool "^true$|^false$" 13 #define paternHex "^[a-fA-F0-9]{1,}$" 14 #define paternBytes paternHex 15 #define paternBytes32 "^[a-fA-F0-9]{%1,%1}$" 135 ParameterABI(
const std::string& _name =
"",
const std::string& _type =
"",
bool _indexed =
false);
137 bool abiIn(
const std::vector<std::string> &value, std::string &
data, std::map<int, std::string>& mapDynamic)
const;
138 bool abiOut(
const std::string &
data,
size_t& pos, std::vector<std::string> &value)
const;
140 static bool getRegularExpession(
const ParameterType ¶mType, QRegularExpression ®Ex);
152 void addDynamic(
const std::string& paramData, std::string &
data, std::map<int, std::string>& mapDynamic)
const;
163 const std::string& _type =
"function",
164 const std::vector<ParameterABI>& _inputs = std::vector<ParameterABI>(),
165 const std::vector<ParameterABI>& _outputs = std::vector<ParameterABI>(),
166 bool _payable =
false,
167 bool _constant =
false,
168 bool _anonymous =
false);
170 bool abiIn(
const std::vector<std::vector<std::string>>& values, std::string&
data, std::vector<ParameterABI::ErrorType>& errors)
const;
172 bool abiOut(
const std::string& data, std::vector<std::vector<std::string>>& values, std::vector<ParameterABI::ErrorType>& errors)
const;
174 std::string selector()
const;
176 static std::string defaultSelector();
178 QString errorMessage(std::vector<ParameterABI::ErrorType>& errors,
bool in)
const;
195 void processDynamicParams(
const std::map<int, std::string>& mapDynamic, std::string& data)
const;
202 bool loads(
const std::string& json_data);
208 #endif // CONTRACTABI_H
std::vector< ParameterABI > outputs
void clean()
clean Set the value to the defaults
size_t decimalBits() const
decimalBits Get the number of bits for the decimal part of the number
size_t length() const
length Length of the list, applicable for list only
bool determine(const std::string &_type)
determine Determine the type from the string
bool isList() const
isList Is the data type list
bool isDynamic() const
isDynamic Check if the type is dynamic.
std::vector< FunctionABI > functions
bytes abiIn(std::string _id, T const &..._t)
T abiOut(bytes const &_data)
The ParameterType class Decode the api parameter type, provide more informations about the data type ...
std::vector< ParameterABI > inputs
const std::string & canonical() const
canonical Get the canonical type
ParameterType m_decodeType
size_t wholeBits() const
wholeBits Get the number of bits for the whole part of the number
ParameterType(const std::string &_type="")
ParameterType Constructor.
size_t totalBytes() const
totalBytes Get the total size in bytes
Type
The Type enum ABI data types.
bool isValid() const
isValid Check if the type is valid
Type type() const
type Get the type