27 cChar ==
' ' || cChar ==
'\t' ||
28 cChar ==
'\r' || cChar ==
'\n' ||
29 cChar == 0x0c || cChar == 0x0b;
34 return cChar ==
'`' || cChar ==
'\'' || cChar ==
'"';
37void CopyUntil(
char*& pTo,
const char*& pFrom,
char cUntil,
bool bIncludeUntil =
false )
50 else if( bIncludeUntil || ! isProtect( *pFrom ) )
56 }
while( *pFrom && *pFrom != cUntil );
58 if( ! isProtect( *pFrom ) || bIncludeUntil )
81 else if( bIncludeUntil || ! isProtect( *pFrom ) )
88 }
while( *pFrom && *pFrom != cUntil );
90 if( ! isProtect( *pFrom ) || bIncludeUntil )
106 sal_Int32 nLen = rLine.getLength();
110 int nActualToken = 0;
115 while( *pRun && nActualToken <=
nToken )
117 while( *pRun && isSpace( *pRun ) )
120 while( *pRun && ! isSpace( *pRun ) )
131 else if( *pRun ==
'`' )
132 CopyUntil( pLeap, pRun,
'`' );
133 else if( *pRun ==
'\'' )
134 CopyUntil( pLeap, pRun,
'\'' );
135 else if( *pRun ==
'"' )
136 CopyUntil( pLeap, pRun,
'"' );
144 if( nActualToken !=
nToken )
151 return OUString(pBuffer);
156 sal_Int32 nLen = rLine.getLength();
160 int nActualToken = 0;
161 char* pBuffer =
static_cast<char*
>(alloca( nLen + 1 ));
162 const char* pRun = rLine.getStr();
163 char* pLeap =
nullptr;
165 while( *pRun && nActualToken <=
nToken )
167 while( *pRun && isSpace( *pRun ) )
170 while( *pRun && ! isSpace( *pRun ) )
181 else if( *pRun ==
'`' )
182 CopyUntil( pLeap, pRun,
'`' );
183 else if( *pRun ==
'\'' )
184 CopyUntil( pLeap, pRun,
'\'' );
185 else if( *pRun ==
'"' )
186 CopyUntil( pLeap, pRun,
'"' );
194 if( nActualToken !=
nToken )
214 while( *pRun && isSpace( *pRun ) )
218 while( *pRun && ! isSpace( *pRun ) )
227 else if( *pRun ==
'`' )
229 do pRun++;
while( *pRun && *pRun !=
'`' );
233 else if( *pRun ==
'\'' )
235 do pRun++;
while( *pRun && *pRun !=
'\'' );
239 else if( *pRun ==
'"' )
241 do pRun++;
while( *pRun && *pRun !=
'"' );
256 size_t nLen = rLine.size();
262 const sal_Unicode *
const pEnd = rLine.data() + rLine.size();
265 while( pRun != pEnd )
267 if( pRun != pEnd && isSpace( *pRun ) )
273 while( pRun != pEnd && isSpace( *pRun ) )
275 while( pRun != pEnd && ! isSpace( *pRun ) )
286 else if( bProtect && *pRun ==
'`' )
287 CopyUntil( pLeap, pRun,
'`',
true );
288 else if( bProtect && *pRun ==
'\'' )
289 CopyUntil( pLeap, pRun,
'\'',
true );
290 else if( bProtect && *pRun ==
'"' )
291 CopyUntil( pLeap, pRun,
'"',
true );
311 return OUString(*pBuffer ==
' ' ? pBuffer+1 : pBuffer);
316 size_t nLen = rLine.size();
320 char *pBuffer =
static_cast<char*
>(alloca( nLen + 1 ));
321 const char *pRun = rLine.data();
322 const char *
const pEnd = rLine.data() + rLine.size();
323 char *pLeap = pBuffer;
325 while( pRun != pEnd )
327 if( pRun != pEnd && isSpace( *pRun ) )
333 while( pRun != pEnd && isSpace( *pRun ) )
335 while( pRun != pEnd && ! isSpace( *pRun ) )
346 else if( *pRun ==
'`' )
347 CopyUntil( pLeap, pRun,
'`',
true );
348 else if( *pRun ==
'\'' )
349 CopyUntil( pLeap, pRun,
'\'',
true );
350 else if( *pRun ==
'"' )
351 CopyUntil( pLeap, pRun,
'"',
true );
364 assert(pLeap > pBuffer);
366#if defined(__GNUC__) && (__GNUC__ == 12 || __GNUC__ == 13)
367#pragma GCC diagnostic push
368#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
372#if defined(__GNUC__) && (__GNUC__ == 12 || __GNUC__ == 13)
373#pragma GCC diagnostic pop
375 return *pBuffer ==
' ' ? pBuffer+1 : pBuffer;
OUString GetCommandLineToken(int nToken, const OUString &rLine)
int GetCommandLineTokenCount(const OUString &rLine)
OUString WhitespaceToSpace(std::u16string_view rLine, bool bProtect)