38 |
#ifndef _PCRE_STRINGPIECE_H |
#ifndef _PCRE_STRINGPIECE_H |
39 |
#define _PCRE_STRINGPIECE_H |
#define _PCRE_STRINGPIECE_H |
40 |
|
|
41 |
#include <string.h> |
#include <cstring> |
42 |
#include <string> |
#include <string> |
43 |
#include <iosfwd> // for ostream forward-declaration |
#include <iosfwd> // for ostream forward-declaration |
44 |
|
|
52 |
|
|
53 |
#include <pcre.h> |
#include <pcre.h> |
54 |
|
|
55 |
|
using std::memcmp; |
56 |
|
using std::strlen; |
57 |
using std::string; |
using std::string; |
58 |
|
|
59 |
namespace pcrecpp { |
namespace pcrecpp { |
70 |
StringPiece() |
StringPiece() |
71 |
: ptr_(NULL), length_(0) { } |
: ptr_(NULL), length_(0) { } |
72 |
StringPiece(const char* str) |
StringPiece(const char* str) |
73 |
: ptr_(str), length_(static_cast<int>(strlen(str))) { } |
: ptr_(str), length_(static_cast<int>(strlen(ptr_))) { } |
74 |
|
StringPiece(const unsigned char* str) |
75 |
|
: ptr_(reinterpret_cast<const char*>(str)), |
76 |
|
length_(static_cast<int>(strlen(ptr_))) { } |
77 |
StringPiece(const string& str) |
StringPiece(const string& str) |
78 |
: ptr_(str.data()), length_(static_cast<int>(str.size())) { } |
: ptr_(str.data()), length_(static_cast<int>(str.size())) { } |
79 |
StringPiece(const char* offset, int len) |
StringPiece(const char* offset, int len) |