Lines Matching refs:std
34 using Properties = std::map<std::string, std::string>;
44 using Args = std::multimap<Option, std::string>;
48 HostFileSystem(const std::string& rootdir) : FileSystemUnderPath(rootdir) {} in HostFileSystem()
49 status_t fetch(const std::string& path, std::string* fetched, in fetch()
50 std::string* error) const override { in fetch()
52 std::cerr << "Debug: Fetch '" << getRootDir() << path << "': " << toString(status) in fetch()
53 << std::endl; in fetch()
56 status_t listFiles(const std::string& path, std::vector<std::string>* out, in listFiles()
57 std::string* error) const override { in listFiles()
59 std::cerr << "Debug: List '" << getRootDir() << path << "': " << toString(status) in listFiles()
60 << std::endl; in listFiles()
65 static std::string toString(status_t status) { in toString()
72 std::string getProperty(const std::string& key, in getProperty()
73 const std::string& defaultValue) const override { in getProperty()
76 std::cerr << "Debug: Sysprop " << key << " is missing, default to '" << defaultValue in getProperty()
77 << "'" << std::endl; in getProperty()
80 std::cerr << "Debug: Sysprop " << key << "=" << it->second << std::endl; in getProperty()
83 uint64_t getUintProperty(const std::string& key, uint64_t defaultValue, in getUintProperty()
86 std::string value = getProperty(key, ""); in getUintProperty()
90 bool getBoolProperty(const std::string& key, bool defaultValue) const override { in getBoolProperty()
91 std::string value = getProperty(key, ""); in getBoolProperty()
102 std::map<std::string, std::string> mProps;
107 std::unique_ptr<T> readObject(FileSystem* fileSystem, const std::string& path, in readObject()
109 std::string xml; in readObject()
110 std::string error; in readObject()
113 std::cerr << "Error: Cannot read '" << path << "' (" << strerror(-err) << "): " << error in readObject()
114 << std::endl; in readObject()
117 auto ret = std::make_unique<T>(); in readObject()
119 std::cerr << "Error: Cannot parse '" << path << "': " << error << std::endl; in readObject()
125 int checkCompatibilityForFiles(const std::string& manifestPath, const std::string& matrixPath) { in checkCompatibilityForFiles()
126 auto fileSystem = std::make_unique<FileSystemImpl>(); in checkCompatibilityForFiles()
133 std::string error; in checkCompatibilityForFiles()
135 std::cerr << "Error: Incompatible: " << error << std::endl; in checkCompatibilityForFiles()
136 std::cout << "false" << std::endl; in checkCompatibilityForFiles()
140 std::cout << "true" << std::endl; in checkCompatibilityForFiles()
148 std::vector<struct option> longopts{ in parseArgs()
155 std::map<int, Option> shortopts{ in parseArgs()
163 std::string argValue = optarg ? optarg : std::string{}; in parseArgs()
165 ret.emplace(static_cast<Option>(longOptFlag), std::move(argValue)); in parseArgs()
167 ret.emplace(shortopts[c], std::move(argValue)); in parseArgs()
172 std::cerr << "unrecognized option `" << argv[optind] << "'" << std::endl; in parseArgs()
184 auto value = pos == std::string::npos ? std::string{} : arg.substr(pos + 1); in getProperties()
191 std::cerr in usage()
192 << me << ": check VINTF metadata." << std::endl in usage()
193 << " Options:" << std::endl in usage()
194 << " --dump-file-list: Dump a list of directories / files on device" << std::endl in usage()
195 << " that is required to be used by --check-compat." << std::endl in usage()
196 << " -c, --check-compat: check compatibility for files under the root" << std::endl in usage()
197 << " directory specified by --root-dir." << std::endl in usage()
198 << " --rootdir=<dir>: specify root directory for all metadata." << std::endl in usage()
199 << " -D, --property <key>=<value>: specify sysprops." << std::endl in usage()
200 << " --help: show this message." << std::endl in usage()
201 << std::endl in usage()
202 << " Example:" << std::endl in usage()
203 << " # Get the list of required files." << std::endl in usage()
204 << " " << me << " --dump-file-list > /tmp/files.txt" << std::endl in usage()
206 << std::endl in usage()
207 << " ROOTDIR=/tmp/device/" << std::endl in usage()
210 << std::endl in usage()
211 << " # Check compatibility." << std::endl in usage()
212 << " " << me << " --check-compat --rootdir=$ROOTDIR \\" << std::endl in usage()
215 << std::endl in usage()
218 << std::endl; in usage()
222 int checkAllFiles(const std::string& rootdir, const Properties& props, std::string* error) { in checkAllFiles()
223 auto hostPropertyFetcher = std::make_unique<PresetPropertyFetcher>(); in checkAllFiles()
226 .setFileSystem(std::make_unique<HostFileSystem>(rootdir)) in checkAllFiles()
227 .setPropertyFetcher(std::move(hostPropertyFetcher)) in checkAllFiles()
253 std::cout << file << std::endl; in main()
264 std::cerr << "Missing --rootdir option." << std::endl; in main()
269 std::cerr << "Debug: checking files under " << rootdir << "..." << std::endl; in main()
270 std::string error; in main()
272 std::cerr << "Debug: files under " << rootdir in main()
277 << std::endl; in main()
280 std::cout << "true" << std::endl; in main()