ReactOS  0.4.12-dev-721-g03c3dd5
kjk Namespace Reference

Namespaces

 details
 

Classes

struct  null_output_iterator
 
struct  null_output_reference
 
class  stringz_iterator
 

Functions

template<class Elem , class Traits , class InIter , class OutIter >
InIter copy_argument (InIter cur, InIter end, OutIter arg)
 
template<class InIter , class OutIter >
InIter copy_argument (InIter cur, InIter end, OutIter arg)
 
template<class Elem , class Traits , class InIter >
InIter skip_argument (InIter cur, InIter end)
 
template<class InIter >
InIter skip_argument (InIter cur, InIter end)
 
template<class CharT >
stringz_iterator< CharT > stringz_begin (const CharT *)
 
template<class Traits , class CharT >
stringz_iterator< CharT, Traits > stringz_begin (const CharT *)
 
template<class CharT >
stringz_iterator< CharT > stringz_end (const CharT *)
 
template<class Traits , class CharT >
stringz_iterator< CharT, Traits > stringz_end (const CharT *)
 
template<class Traits , class CharT >
stringz_iterator< CharT > stringz_begin (const CharT *p)
 
template<class Traits , class CharT >
stringz_iterator< CharT > stringz_end (const CharT *)
 

Function Documentation

◆ copy_argument() [1/2]

template<class Elem , class Traits , class InIter , class OutIter >
InIter kjk::copy_argument ( InIter  cur,
InIter  end,
OutIter  arg 
)

Definition at line 41 of file argv_parser.h.

42  {
43  typename Traits::int_type c;
44  bool quoting = false;
45 
46  while(cur != end)
47  {
48  c = Traits::to_int_type(*cur);
49 
50  if(!details::is_separator<Traits>(c))
51  break;
52 
53  ++ cur;
54  }
55 
56  while(cur != end)
57  {
58  typedef typename std::iterator_traits<InIter>::difference_type difference_type;
59  difference_type backslashes(0);
60 
61  do
62  {
63  c = Traits::to_int_type(*cur);
64  ++ cur;
65 
66  if(Traits::eq_int_type(c, '\\'))
67  ++ backslashes;
68  else
69  break;
70  }
71  while(cur != end);
72 
73  if(Traits::eq_int_type(c, '"'))
74  {
75  // c == '"'
76 
77  if((backslashes % 2) == 0)
78  {
79  // 2N backslashes + "" in quote = N backslashes, literal "
80  if(quoting && cur != end && Traits::eq_int_type(Traits::to_int_type(*cur), '"'))
81  {
82  c = '"';
83  ++ cur;
84  }
85  // 2N backslashes + " = N backslashes, toggle quoting
86  else
87  {
88  quoting = !quoting;
89  c = Traits::eof();
90  }
91 
92  }
93  // 2N+1 backslashes + " = N backslashes, literal "
94 
95  backslashes /= 2;
96  }
97 
98  // Flush backslashes
99  for(difference_type i = 0; i < backslashes; ++ i)
100  *arg ++ = Traits::to_char_type('\\');
101 
102  // Handle current character, unless it was a special quote
103  if(c != Traits::eof())
104  {
105  if(details::is_separator<Traits>(c) && !quoting)
106  break;
107  else
108  *arg ++ = Traits::to_char_type(c);
109  }
110  }
111 
112  while(cur != end)
113  {
114  c = Traits::to_int_type(*cur);
115 
116  if(!details::is_separator<Traits>(c))
117  break;
118 
119  ++ cur;
120  }
121 
122  return cur;
123  }
GLuint GLuint end
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
const GLubyte * c
Definition: glext.h:8905
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
#define c
Definition: ke_i.h:80

Referenced by copy_argument(), and skip_argument().

◆ copy_argument() [2/2]

template<class InIter , class OutIter >
InIter kjk::copy_argument ( InIter  cur,
InIter  end,
OutIter  arg 
)

Definition at line 126 of file argv_parser.h.

127  {
128  return copy_argument
129  <
130  typename std::iterator_traits<InIter>::value_type,
131  typename std::char_traits<typename std::iterator_traits<InIter>::value_type>,
132  InIter,
133  OutIter
134  >
135  (cur, end, arg);
136  }
void * arg
Definition: msvc.h:12
GLuint GLuint end
Definition: gl.h:1545
InIter copy_argument(InIter cur, InIter end, OutIter arg)
Definition: argv_parser.h:126

◆ skip_argument() [1/2]

template<class Elem , class Traits , class InIter >
InIter kjk::skip_argument ( InIter  cur,
InIter  end 
)

Definition at line 139 of file argv_parser.h.

140  {
141  return copy_argument(cur, end, null_output_iterator<Elem>());
142  }
GLuint GLuint end
Definition: gl.h:1545
InIter copy_argument(InIter cur, InIter end, OutIter arg)
Definition: argv_parser.h:126

◆ skip_argument() [2/2]

template<class InIter >
InIter kjk::skip_argument ( InIter  cur,
InIter  end 
)

Definition at line 145 of file argv_parser.h.

146  {
147  return copy_argument
148  <
149  typename std::iterator_traits<InIter>::value_type,
150  typename std::char_traits<typename std::iterator_traits<InIter>::value_type>,
151  InIter
152  >
153  (cur, end, null_output_iterator<typename std::iterator_traits<InIter>::value_type>());
154  }
GLuint GLuint end
Definition: gl.h:1545
InIter copy_argument(InIter cur, InIter end, OutIter arg)
Definition: argv_parser.h:126

◆ stringz_begin() [1/3]

template<class CharT >
stringz_iterator< CharT > kjk::stringz_begin ( const CharT *  p)

Definition at line 104 of file stringz_iterator.h.

105  {
106  return stringz_iterator<CharT>(p);
107  }
GLfloat GLfloat p
Definition: glext.h:8902

◆ stringz_begin() [2/3]

template<class Traits , class CharT >
stringz_iterator<CharT, Traits> kjk::stringz_begin ( const CharT *  )

Definition at line 104 of file stringz_iterator.h.

105  {
106  return stringz_iterator<CharT>(p);
107  }
GLfloat GLfloat p
Definition: glext.h:8902

◆ stringz_begin() [3/3]

template<class Traits , class CharT >
stringz_iterator<CharT> kjk::stringz_begin ( const CharT *  p)

Definition at line 110 of file stringz_iterator.h.

111  {
112  return stringz_iterator<CharT, Traits>(p);
113  }
GLfloat GLfloat p
Definition: glext.h:8902

◆ stringz_end() [1/3]

template<class CharT >
stringz_iterator< CharT > kjk::stringz_end ( const CharT *  )

Definition at line 116 of file stringz_iterator.h.

117  {
118  return stringz_iterator<CharT>(0);
119  }

◆ stringz_end() [2/3]

template<class Traits , class CharT >
stringz_iterator<CharT, Traits> kjk::stringz_end ( const CharT *  )

Definition at line 116 of file stringz_iterator.h.

117  {
118  return stringz_iterator<CharT>(0);
119  }

◆ stringz_end() [3/3]

template<class Traits , class CharT >
stringz_iterator<CharT> kjk::stringz_end ( const CharT *  )

Definition at line 122 of file stringz_iterator.h.

123  {
124  return stringz_iterator<CharT, Traits>(0);
125  }