Skip to content

Instantly share code, notes, and snippets.

@DanSearle
Last active December 24, 2015 15:59
Show Gist options
  • Save DanSearle/6824595 to your computer and use it in GitHub Desktop.
Save DanSearle/6824595 to your computer and use it in GitHub Desktop.
Generate const C++ getters for fields
cat fields.txt | awk 'sub(";","",$2){print "const",$1,"Get"substr(toupper($2), 1,1)substr($2,2)"()","const","{ return",$2"; }"}'
E.g. fields.txt contains:
std::string test;
bool jaunTwoThree;
Note this command will remove semicolons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment