diff --git a/.gitignore b/.gitignore index 4ce6fdd..23a6f7c 100644 --- a/.gitignore +++ b/.gitignore @@ -337,4 +337,7 @@ ASALocalRun/ .localhistory/ # BeatPulse healthcheck temp database -healthchecksdb \ No newline at end of file +healthchecksdb + +# CSV +*.csv \ No newline at end of file diff --git a/Scripts/csv_to_cpp.py b/Scripts/csv_to_cpp.py new file mode 100644 index 0000000..0de6e1d --- /dev/null +++ b/Scripts/csv_to_cpp.py @@ -0,0 +1,33 @@ +import os +import sys +import getopt +import csv + +try: + opts, args = getopt.getopt(sys.argv[1:], "hf:", ["file"]) +except getopt.GetoptError: + print('csv_to_cpp.py -f ') + sys.exit(2) +for opt, arg in opts: + if opt == '-h': + print('csv_to_cpp.py -f ') + sys.exit() + elif opt in ("-f", "--file"): + path = arg + # elif opt in ("-p", "--prefix"): + # prefix = arg + # elif opt in ("-s", "-sufix"): + # sufix = arg + + +f = open("out.cpp", "w") + +category = "" +with open(path, newline="") as file: + reader = csv.reader(file, delimiter=",", quotechar="|") + next(reader) + for row in reader: + if row[0] != "": + category = row[0] + f.write("\n// "+category+"\n") + f.write("_"+category+'->Add("' + row[1] + '");'+ "\n") \ No newline at end of file