File: base.hpp

package info (click to toggle)
higan 094-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,780 kB
  • ctags: 15,643
  • sloc: cpp: 103,963; ansic: 659; makefile: 531; sh: 25
file content (69 lines) | stat: -rwxr-xr-x 2,759 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifdef NALL_STRING_INTERNAL_HPP

//collection of functions to extend libc
//none of these functions require nall::string
//and thus, require no changes when nall::string is modified

namespace nall {

//compare.hpp
inline char chrlower(char c);
inline char chrupper(char c);
inline int imemcmp(const char* str1, const char* str2, unsigned size);
inline int istrcmp(const char* str1, const char* str2);
inline bool strbegin(const char* str, const char* key);
inline bool istrbegin(const char* str, const char* key);
inline bool strend(const char* str, const char* key);
inline bool istrend(const char* str, const char* key);

//convert.hpp
inline char* strlower(char* str);
inline char* strupper(char* str);
inline char* qstrlower(char* str);
inline char* qstrupper(char* str);
inline char* strtr(char* dest, const char* before, const char* after);

//match.hpp
inline bool strmatch(const char* str, const char* pattern);
inline bool istrmatch(const char* str, const char* pattern);
inline bool tokenize(const char* s, const char* p);

//strm.hpp
inline unsigned strmcpy(char* target, const char* source, unsigned length);
inline unsigned strmcat(char* target, const char* source, unsigned length);
inline bool strccpy(char* target, const char* source, unsigned length);
inline bool strccat(char* target, const char* source, unsigned length);
inline void strpcpy(char*& target, const char* source, unsigned& length);

//strpos.hpp
inline optional<unsigned> strpos(const char* str, const char* key);
inline optional<unsigned> istrpos(const char* str, const char* key);
inline optional<unsigned> qstrpos(const char* str, const char* key);
inline optional<unsigned> iqstrpos(const char* str, const char* key);
template<bool Insensitive = false, bool Quoted = false> inline optional<unsigned> ustrpos(const char* str, const char* key);

//trim.hpp
template<unsigned Limit = 0> inline char* ltrim(char* str, const char* key = " ");
template<unsigned Limit = 0> inline char* rtrim(char* str, const char* key = " ");
template<unsigned Limit = 0> inline char* trim(char* str, const char* key = " ");
template<unsigned Limit = 0> inline char* trim(char* str, const char* lkey, const char* rkey);
inline char* strip(char* s);

//utf8.hpp
struct UTF8 {
  unsigned size;       //size of encoded codepoint
  uint64_t data;       //encoded codepoint
  unsigned codepoint;  //decoded codepoint
};
inline UTF8 utf8_read(const char* s);
inline void utf8_write(char* s, const UTF8& utf8);

//utility.hpp
template<bool Insensitive> alwaysinline bool chrequal(char x, char y);
template<bool Quoted, typename T> alwaysinline bool quoteskip(T*& p);
template<bool Quoted, typename T> alwaysinline bool quotecopy(char*& t, T*& p);
inline char* strduplicate(const char* s);

}

#endif