mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 20:15:34 +00:00
Made all C++ files clang-formatted.
Also added missing generated files. Change-Id: Ifd22a643a08e3f2edfce92812ed57b87fc0e1875
This commit is contained in:
@@ -14,20 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "flatbuffers/hash.h"
|
||||
#include <stdio.h>
|
||||
|
||||
enum OutputFormat {
|
||||
kDecimal,
|
||||
kHexadecimal,
|
||||
kHexadecimal0x
|
||||
};
|
||||
enum OutputFormat { kDecimal, kHexadecimal, kHexadecimal0x };
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
const char* name = argv[0];
|
||||
int main(int argc, char *argv[]) {
|
||||
const char *name = argv[0];
|
||||
if (argc <= 1) {
|
||||
printf("%s HASH [OPTION]... STRING... [-- STRING...]\n", name);
|
||||
printf("Available hashing algorithms:\n 32 bit:\n");
|
||||
@@ -50,7 +46,7 @@ int main(int argc, char* argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* hash_algorithm = argv[1];
|
||||
const char *hash_algorithm = argv[1];
|
||||
|
||||
flatbuffers::NamedHashFunction<uint32_t>::HashFunction hash_function32 =
|
||||
flatbuffers::FindHashFunction32(hash_algorithm);
|
||||
@@ -66,15 +62,21 @@ int main(int argc, char* argv[]) {
|
||||
bool annotate = false;
|
||||
bool escape_dash = false;
|
||||
for (int i = 2; i < argc; i++) {
|
||||
const char* arg = argv[i];
|
||||
const char *arg = argv[i];
|
||||
if (!escape_dash && arg[0] == '-') {
|
||||
std::string opt = arg;
|
||||
if (opt == "-d") output_format = kDecimal;
|
||||
else if (opt == "-x") output_format = kHexadecimal;
|
||||
else if (opt == "-0x") output_format = kHexadecimal0x;
|
||||
else if (opt == "-c") annotate = true;
|
||||
else if (opt == "--") escape_dash = true;
|
||||
else printf("Unrecognized argument: \"%s\"\n", arg);
|
||||
if (opt == "-d")
|
||||
output_format = kDecimal;
|
||||
else if (opt == "-x")
|
||||
output_format = kHexadecimal;
|
||||
else if (opt == "-0x")
|
||||
output_format = kHexadecimal0x;
|
||||
else if (opt == "-c")
|
||||
annotate = true;
|
||||
else if (opt == "--")
|
||||
escape_dash = true;
|
||||
else
|
||||
printf("Unrecognized argument: \"%s\"\n", arg);
|
||||
} else {
|
||||
std::stringstream ss;
|
||||
if (output_format == kDecimal) {
|
||||
@@ -90,8 +92,7 @@ int main(int argc, char* argv[]) {
|
||||
else if (hash_function64)
|
||||
ss << hash_function64(arg);
|
||||
|
||||
if (annotate)
|
||||
ss << " /* \"" << arg << "\" */";
|
||||
if (annotate) ss << " /* \"" << arg << "\" */";
|
||||
|
||||
ss << "\n";
|
||||
|
||||
@@ -100,4 +101,3 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user