Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include
File: pcrecpparg.h
// Copyright (c) 2005, Google Inc.
[0] Fix | Delete
// All rights reserved.
[1] Fix | Delete
//
[2] Fix | Delete
// Redistribution and use in source and binary forms, with or without
[3] Fix | Delete
// modification, are permitted provided that the following conditions are
[4] Fix | Delete
// met:
[5] Fix | Delete
//
[6] Fix | Delete
// * Redistributions of source code must retain the above copyright
[7] Fix | Delete
// notice, this list of conditions and the following disclaimer.
[8] Fix | Delete
// * Redistributions in binary form must reproduce the above
[9] Fix | Delete
// copyright notice, this list of conditions and the following disclaimer
[10] Fix | Delete
// in the documentation and/or other materials provided with the
[11] Fix | Delete
// distribution.
[12] Fix | Delete
// * Neither the name of Google Inc. nor the names of its
[13] Fix | Delete
// contributors may be used to endorse or promote products derived from
[14] Fix | Delete
// this software without specific prior written permission.
[15] Fix | Delete
//
[16] Fix | Delete
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
[17] Fix | Delete
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
[18] Fix | Delete
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
[19] Fix | Delete
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
[20] Fix | Delete
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
[21] Fix | Delete
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
[22] Fix | Delete
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
[23] Fix | Delete
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
[24] Fix | Delete
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
[25] Fix | Delete
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
[26] Fix | Delete
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[27] Fix | Delete
//
[28] Fix | Delete
// Author: Sanjay Ghemawat
[29] Fix | Delete
[30] Fix | Delete
#ifndef _PCRECPPARG_H
[31] Fix | Delete
#define _PCRECPPARG_H
[32] Fix | Delete
[33] Fix | Delete
#include <stdlib.h> // for NULL
[34] Fix | Delete
#include <string>
[35] Fix | Delete
[36] Fix | Delete
#include <pcre.h>
[37] Fix | Delete
[38] Fix | Delete
namespace pcrecpp {
[39] Fix | Delete
[40] Fix | Delete
class StringPiece;
[41] Fix | Delete
[42] Fix | Delete
// Hex/Octal/Binary?
[43] Fix | Delete
[44] Fix | Delete
// Special class for parsing into objects that define a ParseFrom() method
[45] Fix | Delete
template <class T>
[46] Fix | Delete
class _RE_MatchObject {
[47] Fix | Delete
public:
[48] Fix | Delete
static inline bool Parse(const char* str, int n, void* dest) {
[49] Fix | Delete
if (dest == NULL) return true;
[50] Fix | Delete
T* object = reinterpret_cast<T*>(dest);
[51] Fix | Delete
return object->ParseFrom(str, n);
[52] Fix | Delete
}
[53] Fix | Delete
};
[54] Fix | Delete
[55] Fix | Delete
class PCRECPP_EXP_DEFN Arg {
[56] Fix | Delete
public:
[57] Fix | Delete
// Empty constructor so we can declare arrays of Arg
[58] Fix | Delete
Arg();
[59] Fix | Delete
[60] Fix | Delete
// Constructor specially designed for NULL arguments
[61] Fix | Delete
Arg(void*);
[62] Fix | Delete
[63] Fix | Delete
typedef bool (*Parser)(const char* str, int n, void* dest);
[64] Fix | Delete
[65] Fix | Delete
// Type-specific parsers
[66] Fix | Delete
#define PCRE_MAKE_PARSER(type,name) \
[67] Fix | Delete
Arg(type* p) : arg_(p), parser_(name) { } \
[68] Fix | Delete
Arg(type* p, Parser parser) : arg_(p), parser_(parser) { }
[69] Fix | Delete
[70] Fix | Delete
[71] Fix | Delete
PCRE_MAKE_PARSER(char, parse_char);
[72] Fix | Delete
PCRE_MAKE_PARSER(unsigned char, parse_uchar);
[73] Fix | Delete
PCRE_MAKE_PARSER(short, parse_short);
[74] Fix | Delete
PCRE_MAKE_PARSER(unsigned short, parse_ushort);
[75] Fix | Delete
PCRE_MAKE_PARSER(int, parse_int);
[76] Fix | Delete
PCRE_MAKE_PARSER(unsigned int, parse_uint);
[77] Fix | Delete
PCRE_MAKE_PARSER(long, parse_long);
[78] Fix | Delete
PCRE_MAKE_PARSER(unsigned long, parse_ulong);
[79] Fix | Delete
#if 1
[80] Fix | Delete
PCRE_MAKE_PARSER(long long, parse_longlong);
[81] Fix | Delete
#endif
[82] Fix | Delete
#if 1
[83] Fix | Delete
PCRE_MAKE_PARSER(unsigned long long, parse_ulonglong);
[84] Fix | Delete
#endif
[85] Fix | Delete
PCRE_MAKE_PARSER(float, parse_float);
[86] Fix | Delete
PCRE_MAKE_PARSER(double, parse_double);
[87] Fix | Delete
PCRE_MAKE_PARSER(std::string, parse_string);
[88] Fix | Delete
PCRE_MAKE_PARSER(StringPiece, parse_stringpiece);
[89] Fix | Delete
[90] Fix | Delete
#undef PCRE_MAKE_PARSER
[91] Fix | Delete
[92] Fix | Delete
// Generic constructor
[93] Fix | Delete
template <class T> Arg(T*, Parser parser);
[94] Fix | Delete
// Generic constructor template
[95] Fix | Delete
template <class T> Arg(T* p)
[96] Fix | Delete
: arg_(p), parser_(_RE_MatchObject<T>::Parse) {
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
// Parse the data
[100] Fix | Delete
bool Parse(const char* str, int n) const;
[101] Fix | Delete
[102] Fix | Delete
private:
[103] Fix | Delete
void* arg_;
[104] Fix | Delete
Parser parser_;
[105] Fix | Delete
[106] Fix | Delete
static bool parse_null (const char* str, int n, void* dest);
[107] Fix | Delete
static bool parse_char (const char* str, int n, void* dest);
[108] Fix | Delete
static bool parse_uchar (const char* str, int n, void* dest);
[109] Fix | Delete
static bool parse_float (const char* str, int n, void* dest);
[110] Fix | Delete
static bool parse_double (const char* str, int n, void* dest);
[111] Fix | Delete
static bool parse_string (const char* str, int n, void* dest);
[112] Fix | Delete
static bool parse_stringpiece (const char* str, int n, void* dest);
[113] Fix | Delete
[114] Fix | Delete
#define PCRE_DECLARE_INTEGER_PARSER(name) \
[115] Fix | Delete
private: \
[116] Fix | Delete
static bool parse_ ## name(const char* str, int n, void* dest); \
[117] Fix | Delete
static bool parse_ ## name ## _radix( \
[118] Fix | Delete
const char* str, int n, void* dest, int radix); \
[119] Fix | Delete
public: \
[120] Fix | Delete
static bool parse_ ## name ## _hex(const char* str, int n, void* dest); \
[121] Fix | Delete
static bool parse_ ## name ## _octal(const char* str, int n, void* dest); \
[122] Fix | Delete
static bool parse_ ## name ## _cradix(const char* str, int n, void* dest)
[123] Fix | Delete
[124] Fix | Delete
PCRE_DECLARE_INTEGER_PARSER(short);
[125] Fix | Delete
PCRE_DECLARE_INTEGER_PARSER(ushort);
[126] Fix | Delete
PCRE_DECLARE_INTEGER_PARSER(int);
[127] Fix | Delete
PCRE_DECLARE_INTEGER_PARSER(uint);
[128] Fix | Delete
PCRE_DECLARE_INTEGER_PARSER(long);
[129] Fix | Delete
PCRE_DECLARE_INTEGER_PARSER(ulong);
[130] Fix | Delete
PCRE_DECLARE_INTEGER_PARSER(longlong);
[131] Fix | Delete
PCRE_DECLARE_INTEGER_PARSER(ulonglong);
[132] Fix | Delete
[133] Fix | Delete
#undef PCRE_DECLARE_INTEGER_PARSER
[134] Fix | Delete
};
[135] Fix | Delete
[136] Fix | Delete
inline Arg::Arg() : arg_(NULL), parser_(parse_null) { }
[137] Fix | Delete
inline Arg::Arg(void* p) : arg_(p), parser_(parse_null) { }
[138] Fix | Delete
[139] Fix | Delete
inline bool Arg::Parse(const char* str, int n) const {
[140] Fix | Delete
return (*parser_)(str, n, arg_);
[141] Fix | Delete
}
[142] Fix | Delete
[143] Fix | Delete
// This part of the parser, appropriate only for ints, deals with bases
[144] Fix | Delete
#define MAKE_INTEGER_PARSER(type, name) \
[145] Fix | Delete
inline Arg Hex(type* ptr) { \
[146] Fix | Delete
return Arg(ptr, Arg::parse_ ## name ## _hex); } \
[147] Fix | Delete
inline Arg Octal(type* ptr) { \
[148] Fix | Delete
return Arg(ptr, Arg::parse_ ## name ## _octal); } \
[149] Fix | Delete
inline Arg CRadix(type* ptr) { \
[150] Fix | Delete
return Arg(ptr, Arg::parse_ ## name ## _cradix); }
[151] Fix | Delete
[152] Fix | Delete
MAKE_INTEGER_PARSER(short, short) /* */
[153] Fix | Delete
MAKE_INTEGER_PARSER(unsigned short, ushort) /* */
[154] Fix | Delete
MAKE_INTEGER_PARSER(int, int) /* Don't use semicolons */
[155] Fix | Delete
MAKE_INTEGER_PARSER(unsigned int, uint) /* after these statement */
[156] Fix | Delete
MAKE_INTEGER_PARSER(long, long) /* because they can cause */
[157] Fix | Delete
MAKE_INTEGER_PARSER(unsigned long, ulong) /* compiler warnings if */
[158] Fix | Delete
#if 1 /* the checking level is */
[159] Fix | Delete
MAKE_INTEGER_PARSER(long long, longlong) /* turned up high enough. */
[160] Fix | Delete
#endif /* */
[161] Fix | Delete
#if 1 /* */
[162] Fix | Delete
MAKE_INTEGER_PARSER(unsigned long long, ulonglong) /* */
[163] Fix | Delete
#endif
[164] Fix | Delete
[165] Fix | Delete
#undef PCRE_IS_SET
[166] Fix | Delete
#undef PCRE_SET_OR_CLEAR
[167] Fix | Delete
#undef MAKE_INTEGER_PARSER
[168] Fix | Delete
[169] Fix | Delete
} // namespace pcrecpp
[170] Fix | Delete
[171] Fix | Delete
[172] Fix | Delete
#endif /* _PCRECPPARG_H */
[173] Fix | Delete
[174] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function