18 if(!strDataHexIn.empty()) {
33 std::vector<unsigned char> v =
ParseHex(strDataHexIn);
34 strData = std::string(v.begin(), v.end());
80 if(strName.size() > 40) {
87 if(strNameStripped.empty()) {
92 static const std::string strAllowedChars =
"-_abcdefghijklmnopqrstuvwxyz0123456789";
94 std::transform(strName.begin(), strName.end(), strName.begin(), ::tolower);
96 if(strName.find_first_not_of(strAllowedChars) != std::string::npos) {
106 int64_t nStartEpoch = 0;
107 int64_t nEndEpoch = 0;
119 if(nEndEpoch <= nStartEpoch) {
150 std::string strPaymentAddress;
152 if(!
GetDataValue(
"payment_address", strPaymentAddress)) {
157 static const std::string base58chars =
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
159 size_t nLength = strPaymentAddress.size();
161 if((nLength < 26) || (nLength > 35)) {
166 if(strPaymentAddress.find_first_not_of(base58chars) != std::string::npos) {
190 if(strURLStripped.size() < 4U) {
214 std::vector<UniValue> arr1 = obj.
getValues();
215 std::vector<UniValue> arr2 = arr1.at(0).getValues();
219 catch(std::exception& e) {
234 catch(std::exception& e) {
257 catch(std::exception& e) {
280 catch(std::exception& e) {
291 static const std::string strWhitespace =
" \f\n\r\t\v";
293 std::string::size_type nStart = strIn.find_first_not_of(strWhitespace);
294 std::string::size_type nEnd = strIn.find_last_not_of(strWhitespace);
296 if((nStart == std::string::npos) || (nEnd == std::string::npos)) {
297 return std::string();
300 return strIn.substr(nStart, nEnd - nStart + 1);
311 std::string strRest(strURLIn);
312 std::string::size_type nPos = strRest.find(
':');
314 if(nPos != std::string::npos) {
317 if(nPos < strRest.size()) {
318 strRest = strRest.substr(nPos + 1);
326 if((strRest.size() > 2) && (strRest.substr(0,2) ==
"//")) {
327 static const std::string strNetlocDelimiters =
"/?#";
329 strRest = strRest.substr(2);
331 std::string::size_type nPos2 = strRest.find_first_of(strNetlocDelimiters);
333 std::string strNetloc = strRest.substr(0,nPos2);
335 if((strNetloc.find(
'[') != std::string::npos) && (strNetloc.find(
']') == std::string::npos)) {
339 if((strNetloc.find(
']') != std::string::npos) && (strNetloc.find(
'[') == std::string::npos)) {
bool ValidatePaymentAddress()
bool ValidateStartEndEpoch()
static std::string StripWhitespace(const std::string &strIn)
static bool CheckURL(const std::string &strURLIn)
int64_t get_int64() const
void SetHexData(const std::string &strDataHexIn)
bool GetDataValue(const std::string &strKey, std::string &strValue)
bool ValidatePaymentAmount()
std::string strErrorMessages
vector< unsigned char > ParseHex(const char *psz)
enum VType getType() const
bool read(const char *raw)
CProposalValidator(const std::string &strDataHexIn=std::string())
std::string get_str() const
std::vector< UniValue > getValues() const