From: Andreas Schuh Date: Mon, 29 Feb 2016 17:12:15 +0000 (+0000) Subject: enh: Add usage of DEFINE_validator to test project X-Git-Tag: accepted/tizen/5.0/unified/20181102.024438~76 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ef0d5220eb9ebd9044b935b62a02b35024f9686;p=platform%2Fupstream%2Fgflags.git enh: Add usage of DEFINE_validator to test project --- diff --git a/test/config/main.cc b/test/config/main.cc index 5edd9a1..3c033e3 100644 --- a/test/config/main.cc +++ b/test/config/main.cc @@ -3,9 +3,16 @@ DEFINE_string(message, "Hello World!", "The message to print"); +static bool ValidateMessage(const char* flagname, const std::string &message) +{ + return !message.empty(); +} +DEFINE_validator(message, ValidateMessage); + int main(int argc, char **argv) { gflags::SetUsageMessage("Test CMake configuration of gflags library (gflags-config.cmake)"); + gflags::SetVersionString("0.1"); gflags::ParseCommandLineFlags(&argc, &argv, true); std::cout << FLAGS_message << std::endl; gflags::ShutDownCommandLineFlags();