360 }; |
360 }; |
361 |
361 |
362 |
362 |
363 class CommandLineFlags { |
363 class CommandLineFlags { |
364 public: |
364 public: |
365 static bool boolAt(char* name, size_t len, bool* value); |
365 static bool boolAt(const char* name, size_t len, bool* value); |
366 static bool boolAt(char* name, bool* value) { return boolAt(name, strlen(name), value); } |
366 static bool boolAt(const char* name, bool* value) { return boolAt(name, strlen(name), value); } |
367 static bool boolAtPut(char* name, size_t len, bool* value, Flag::Flags origin); |
367 static bool boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin); |
368 static bool boolAtPut(char* name, bool* value, Flag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); } |
368 static bool boolAtPut(const char* name, bool* value, Flag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); } |
369 |
369 |
370 static bool intxAt(char* name, size_t len, intx* value); |
370 static bool intxAt(const char* name, size_t len, intx* value); |
371 static bool intxAt(char* name, intx* value) { return intxAt(name, strlen(name), value); } |
371 static bool intxAt(const char* name, intx* value) { return intxAt(name, strlen(name), value); } |
372 static bool intxAtPut(char* name, size_t len, intx* value, Flag::Flags origin); |
372 static bool intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin); |
373 static bool intxAtPut(char* name, intx* value, Flag::Flags origin) { return intxAtPut(name, strlen(name), value, origin); } |
373 static bool intxAtPut(const char* name, intx* value, Flag::Flags origin) { return intxAtPut(name, strlen(name), value, origin); } |
374 |
374 |
375 static bool uintxAt(char* name, size_t len, uintx* value); |
375 static bool uintxAt(const char* name, size_t len, uintx* value); |
376 static bool uintxAt(char* name, uintx* value) { return uintxAt(name, strlen(name), value); } |
376 static bool uintxAt(const char* name, uintx* value) { return uintxAt(name, strlen(name), value); } |
377 static bool uintxAtPut(char* name, size_t len, uintx* value, Flag::Flags origin); |
377 static bool uintxAtPut(const char* name, size_t len, uintx* value, Flag::Flags origin); |
378 static bool uintxAtPut(char* name, uintx* value, Flag::Flags origin) { return uintxAtPut(name, strlen(name), value, origin); } |
378 static bool uintxAtPut(const char* name, uintx* value, Flag::Flags origin) { return uintxAtPut(name, strlen(name), value, origin); } |
379 |
379 |
380 static bool uint64_tAt(char* name, size_t len, uint64_t* value); |
380 static bool uint64_tAt(const char* name, size_t len, uint64_t* value); |
381 static bool uint64_tAt(char* name, uint64_t* value) { return uint64_tAt(name, strlen(name), value); } |
381 static bool uint64_tAt(const char* name, uint64_t* value) { return uint64_tAt(name, strlen(name), value); } |
382 static bool uint64_tAtPut(char* name, size_t len, uint64_t* value, Flag::Flags origin); |
382 static bool uint64_tAtPut(const char* name, size_t len, uint64_t* value, Flag::Flags origin); |
383 static bool uint64_tAtPut(char* name, uint64_t* value, Flag::Flags origin) { return uint64_tAtPut(name, strlen(name), value, origin); } |
383 static bool uint64_tAtPut(const char* name, uint64_t* value, Flag::Flags origin) { return uint64_tAtPut(name, strlen(name), value, origin); } |
384 |
384 |
385 static bool doubleAt(char* name, size_t len, double* value); |
385 static bool doubleAt(const char* name, size_t len, double* value); |
386 static bool doubleAt(char* name, double* value) { return doubleAt(name, strlen(name), value); } |
386 static bool doubleAt(const char* name, double* value) { return doubleAt(name, strlen(name), value); } |
387 static bool doubleAtPut(char* name, size_t len, double* value, Flag::Flags origin); |
387 static bool doubleAtPut(const char* name, size_t len, double* value, Flag::Flags origin); |
388 static bool doubleAtPut(char* name, double* value, Flag::Flags origin) { return doubleAtPut(name, strlen(name), value, origin); } |
388 static bool doubleAtPut(const char* name, double* value, Flag::Flags origin) { return doubleAtPut(name, strlen(name), value, origin); } |
389 |
389 |
390 static bool ccstrAt(char* name, size_t len, ccstr* value); |
390 static bool ccstrAt(const char* name, size_t len, ccstr* value); |
391 static bool ccstrAt(char* name, ccstr* value) { return ccstrAt(name, strlen(name), value); } |
391 static bool ccstrAt(const char* name, ccstr* value) { return ccstrAt(name, strlen(name), value); } |
392 // Contract: Flag will make private copy of the incoming value. |
392 // Contract: Flag will make private copy of the incoming value. |
393 // Outgoing value is always malloc-ed, and caller MUST call free. |
393 // Outgoing value is always malloc-ed, and caller MUST call free. |
394 static bool ccstrAtPut(char* name, size_t len, ccstr* value, Flag::Flags origin); |
394 static bool ccstrAtPut(const char* name, size_t len, ccstr* value, Flag::Flags origin); |
395 static bool ccstrAtPut(char* name, ccstr* value, Flag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); } |
395 static bool ccstrAtPut(const char* name, ccstr* value, Flag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); } |
396 |
396 |
397 // Returns false if name is not a command line flag. |
397 // Returns false if name is not a command line flag. |
398 static bool wasSetOnCmdline(const char* name, bool* value); |
398 static bool wasSetOnCmdline(const char* name, bool* value); |
399 static void printSetFlags(outputStream* out); |
399 static void printSetFlags(outputStream* out); |
400 |
400 |