/usr/share/cagefs-skeleton/usr/include
// Copyright (c) 2005, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Author: Sanjay Ghemawat // // A string like object that points into another piece of memory. // Useful for providing an interface that allows clients to easily // pass in either a "const char*" or a "string". // // Arghh! I wish C++ literals were automatically of type "string". #ifndef _PCRE_STRINGPIECE_H #define _PCRE_STRINGPIECE_H #include <cstring> #include <string> #include <iosfwd> // for ostream forward-declaration #if 0 #define HAVE_TYPE_TRAITS #include <type_traits.h> #elif 0 #define HAVE_TYPE_TRAITS #include <bits/type_traits.h> #endif #include <pcre.h> namespace pcrecpp { using std::memcmp; using std::strlen; using std::string; class PCRECPP_EXP_DEFN StringPiece { private: const char* ptr_; int length_; public: // We provide non-explicit singleton constructors so users can pass // in a "const char*" or a "string" wherever a "StringPiece" is // expected. StringPiece() : ptr_(NULL), length_(0) { } StringPiece(const char* str) : ptr_(str), length_(static_cast<int>(strlen(ptr_))) { } StringPiece(const unsigned char* str) : ptr_(reinterpret_cast<const char*>(str)), length_(static_cast<int>(strlen(ptr_))) { } StringPiece(const string& str) : ptr_(str.data()), length_(static_cast<int>(str.size())) { } StringPiece(const char* offset, int len) : ptr_(offset), length_(len) { } // data() may return a pointer to a buffer with embedded NULs, and the // returned buffer may or may not be null terminated. Therefore it is // typically a mistake to pass data() to a routine that expects a NUL // terminated string. Use "as_string().c_str()" if you really need to do // this. Or better yet, change your routine so it does not rely on NUL // termination. const char* data() const { return ptr_; } int size() const { return length_; } bool empty() const { return length_ == 0; } void clear() { ptr_ = NULL; length_ = 0; } void set(const char* buffer, int len) { ptr_ = buffer; length_ = len; } void set(const char* str) { ptr_ = str; length_ = static_cast<int>(strlen(str)); } void set(const void* buffer, int len) { ptr_ = reinterpret_cast<const char*>(buffer); length_ = len; } char operator[](int i) const { return ptr_[i]; } void remove_prefix(int n) { ptr_ += n; length_ -= n; } void remove_suffix(int n) { length_ -= n; } bool operator==(const StringPiece& x) const { return ((length_ == x.length_) && (memcmp(ptr_, x.ptr_, length_) == 0)); } bool operator!=(const StringPiece& x) const { return !(*this == x); } #define STRINGPIECE_BINARY_PREDICATE(cmp,auxcmp) \ bool operator cmp (const StringPiece& x) const { \ int r = memcmp(ptr_, x.ptr_, length_ < x.length_ ? length_ : x.length_); \ return ((r auxcmp 0) || ((r == 0) && (length_ cmp x.length_))); \ } STRINGPIECE_BINARY_PREDICATE(<, <); STRINGPIECE_BINARY_PREDICATE(<=, <); STRINGPIECE_BINARY_PREDICATE(>=, >); STRINGPIECE_BINARY_PREDICATE(>, >); #undef STRINGPIECE_BINARY_PREDICATE int compare(const StringPiece& x) const { int r = memcmp(ptr_, x.ptr_, length_ < x.length_ ? length_ : x.length_); if (r == 0) { if (length_ < x.length_) r = -1; else if (length_ > x.length_) r = +1; } return r; } string as_string() const { return string(data(), size()); } void CopyToString(string* target) const { target->assign(ptr_, length_); } // Does "this" start with "x" bool starts_with(const StringPiece& x) const { return ((length_ >= x.length_) && (memcmp(ptr_, x.ptr_, x.length_) == 0)); } }; } // namespace pcrecpp // ------------------------------------------------------------------ // Functions used to create STL containers that use StringPiece // Remember that a StringPiece's lifetime had better be less than // that of the underlying string or char*. If it is not, then you // cannot safely store a StringPiece into an STL container // ------------------------------------------------------------------ #ifdef HAVE_TYPE_TRAITS // This makes vector<StringPiece> really fast for some STL implementations template<> struct __type_traits<pcrecpp::StringPiece> { typedef __true_type has_trivial_default_constructor; typedef __true_type has_trivial_copy_constructor; typedef __true_type has_trivial_assignment_operator; typedef __true_type has_trivial_destructor; typedef __true_type is_POD_type; }; #endif // allow StringPiece to be logged PCRECPP_EXP_DECL std::ostream& operator<<(std::ostream& o, const pcrecpp::StringPiece& piece); #endif /* _PCRE_STRINGPIECE_H */
.
Edit
..
Edit
FlexLexer.h
Edit
GL
Edit
X11
Edit
a.out.h
Edit
absl
Edit
aio.h
Edit
aliases.h
Edit
alloca.h
Edit
ar.h
Edit
ares.h
Edit
ares_build.h
Edit
ares_dns.h
Edit
ares_nameser.h
Edit
ares_rules.h
Edit
ares_version.h
Edit
argp.h
Edit
argz.h
Edit
arpa
Edit
asm
Edit
asm-generic
Edit
assert.h
Edit
autosprintf.h
Edit
bind9
Edit
bits
Edit
blkid
Edit
brotli
Edit
bsock
Edit
byteswap.h
Edit
bzlib.h
Edit
c++
Edit
com_err.h
Edit
complex.h
Edit
cpio.h
Edit
cpuidle.h
Edit
crypt.h
Edit
ctype.h
Edit
curl
Edit
curses.h
Edit
cursesapp.h
Edit
cursesf.h
Edit
cursesm.h
Edit
cursesp.h
Edit
cursesw.h
Edit
cursslk.h
Edit
dbm.h
Edit
dirent.h
Edit
dlfcn.h
Edit
drm
Edit
e2p
Edit
elf.h
Edit
endian.h
Edit
entities.h
Edit
envz.h
Edit
err.h
Edit
errno.h
Edit
error.h
Edit
et
Edit
eti.h
Edit
etip.h
Edit
evdns.h
Edit
event.h
Edit
event2
Edit
evhttp.h
Edit
evrpc.h
Edit
evutil.h
Edit
execinfo.h
Edit
expat.h
Edit
expat_config.h
Edit
expat_external.h
Edit
ext2fs
Edit
fcntl.h
Edit
features-time64.h
Edit
features.h
Edit
fenv.h
Edit
ffi-x86_64.h
Edit
ffi.h
Edit
ffitarget-x86_64.h
Edit
ffitarget.h
Edit
finclude
Edit
fmtmsg.h
Edit
fnmatch.h
Edit
fontconfig
Edit
form.h
Edit
fpu_control.h
Edit
freetype2
Edit
fstab.h
Edit
fstrm
Edit
fstrm.h
Edit
fts.h
Edit
ftw.h
Edit
gconv.h
Edit
gd.h
Edit
gd_color_map.h
Edit
gd_errors.h
Edit
gd_io.h
Edit
gdbm
Edit
gdbm.h
Edit
gdcache.h
Edit
gdfontg.h
Edit
gdfontl.h
Edit
gdfontmb.h
Edit
gdfonts.h
Edit
gdfontt.h
Edit
gdfx.h
Edit
gdpp.h
Edit
getopt.h
Edit
gettext-po.h
Edit
gio-unix-2.0
Edit
glib-2.0
Edit
glob.h
Edit
gmock
Edit
gnu
Edit
gnu-versions.h
Edit
gnumake.h
Edit
google
Edit
gpg-error.h
Edit
gpgrt.h
Edit
graphite2
Edit
grp.h
Edit
grpc
Edit
grpc++
Edit
grpcpp
Edit
gshadow.h
Edit
gssapi
Edit
gssapi.h
Edit
gssrpc
Edit
gtest
Edit
harfbuzz
Edit
iconv.h
Edit
idn-free.h
Edit
idn-int.h
Edit
idna.h
Edit
ieee754.h
Edit
ifaddrs.h
Edit
inttypes.h
Edit
jconfig-64.h
Edit
jconfig.h
Edit
jerror.h
Edit
jmorecfg.h
Edit
jpegint.h
Edit
jpeglib.h
Edit
json-c
Edit
kadm5
Edit
kdb.h
Edit
keyutils.h
Edit
krad.h
Edit
krb5
Edit
krb5.h
Edit
langinfo.h
Edit
lastlog.h
Edit
libaio.h
Edit
libexslt
Edit
libgen.h
Edit
libintl.h
Edit
libltdl
Edit
libmount
Edit
libpng16
Edit
libxml2
Edit
libxslt
Edit
limits.h
Edit
link.h
Edit
linux
Edit
lmdb.h
Edit
locale.h
Edit
ltdl.h
Edit
lzma
Edit
lzma.h
Edit
malloc.h
Edit
math.h
Edit
maxminddb.h
Edit
maxminddb_config-64.h
Edit
maxminddb_config.h
Edit
mcheck.h
Edit
memory.h
Edit
menu.h
Edit
misc
Edit
mntent.h
Edit
monetary.h
Edit
mqueue.h
Edit
mtd
Edit
mysql
Edit
nc_tparm.h
Edit
ncurses
Edit
ncurses.h
Edit
ncurses_dll.h
Edit
ncursesw
Edit
ndbm.h
Edit
net
Edit
netash
Edit
netatalk
Edit
netax25
Edit
netdb.h
Edit
neteconet
Edit
netinet
Edit
netipx
Edit
netiucv
Edit
netpacket
Edit
netrom
Edit
netrose
Edit
nfs
Edit
nl_types.h
Edit
nss.h
Edit
obstack.h
Edit
openssl
Edit
panel.h
Edit
paths.h
Edit
pcp
Edit
pcre.h
Edit
pcre2.h
Edit
pcre2posix.h
Edit
pcre_scanner.h
Edit
pcre_stringpiece.h
Edit
pcrecpp.h
Edit
pcrecpparg.h
Edit
pcreposix.h
Edit
png.h
Edit
pngconf.h
Edit
pnglibconf.h
Edit
poll.h
Edit
powercap.h
Edit
pr29.h
Edit
printf.h
Edit
proc_service.h
Edit
profile.h
Edit
protobuf-c
Edit
protocols
Edit
pthread.h
Edit
pty.h
Edit
punycode.h
Edit
pwd.h
Edit
python3.9
Edit
rdma
Edit
re2
Edit
re_comp.h
Edit
regex.h
Edit
regexp.h
Edit
resolv.h
Edit
rpc
Edit
sched.h
Edit
scsi
Edit
search.h
Edit
security
Edit
selinux
Edit
semaphore.h
Edit
sepol
Edit
setjmp.h
Edit
sgtty.h
Edit
shadow.h
Edit
signal.h
Edit
sound
Edit
spawn.h
Edit
stab.h
Edit
stdc-predef.h
Edit
stdint.h
Edit
stdio.h
Edit
stdio_ext.h
Edit
stdlib.h
Edit
string.h
Edit
stringprep.h
Edit
strings.h
Edit
sys
Edit
syscall.h
Edit
sysexits.h
Edit
syslog.h
Edit
sysprof-4
Edit
tar.h
Edit
term.h
Edit
term_entry.h
Edit
termcap.h
Edit
termio.h
Edit
termios.h
Edit
tgmath.h
Edit
thread_db.h
Edit
threads.h
Edit
tic.h
Edit
tiff.h
Edit
tiffconf-64.h
Edit
tiffconf.h
Edit
tiffio.h
Edit
tiffio.hxx
Edit
tiffvers.h
Edit
time.h
Edit
tld.h
Edit
ttyent.h
Edit
uchar.h
Edit
ucontext.h
Edit
ulimit.h
Edit
unctrl.h
Edit
unicode
Edit
unistd.h
Edit
utime.h
Edit
utmp.h
Edit
utmpx.h
Edit
values.h
Edit
verto-module.h
Edit
verto.h
Edit
video
Edit
wait.h
Edit
wchar.h
Edit
wctype.h
Edit
webp
Edit
wordexp.h
Edit
xcb
Edit
xen
Edit
zconf.h
Edit
zlib.h
Edit