nostalgia/scripts/newcpp

17 lines
463 B
Plaintext
Raw Normal View History

2016-03-26 15:49:05 -05:00
#! /usr/bin/env python
import sys
if len(sys.argv) < 3:
sys.exit(1)
pkg = sys.argv[1]
name = sys.argv[2]
ifdef = "WOMBAT_%s_%s_HPP" % (pkg.upper(), name.upper())
namespace = "namespace wombat {\nnamespace %s {\n\n}\n}" % pkg
hpp = "#ifndef %s\n#define %s\n\n%s\n\n#endif" % (ifdef, ifdef, namespace)
cpp = "#include \"%s.hpp\"\n\n%s" % (name, namespace)
open("src/%s/%s.hpp" % (pkg, name), "w").write(hpp)
open("src/%s/%s.cpp" % (pkg, name), "w").write(cpp)