extends c

###########################################################################
#                            TextMate Snippets                            #
###########################################################################
snippet cl "class .. (class)" !
class ${1:`!p snip.rv = snip.basename or "name"`}
{
public:
  ${1/(\w+).*/$1/}(${2:arguments});
  virtual ~${1/(\w+).*/$1/}();

private:
  ${0:/* data */}
};
endsnippet

snippet ns "namespace .. (namespace)" !
namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
{
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}${1/.+/ \/\/ namespace /m}$1${1/.+/ /m}
endsnippet

snippet readfile "read file (readF)" !
std::vector<char> v;
if (FILE *fp = fopen(${1:"filename"}, "r"))
{
  char buf[1024];
  while(size_t len = fread(buf, 1, sizeof(buf), fp))
	  v.insert(v.end(), buf, buf + len);
  fclose(fp);
}
endsnippet

snippet cerr "std::cerr" !
std::cerr << ${1} << std::endl;
endsnippet

snippet doc "document" !
/**
 * ${1}
 */
endsnippet

# vim:ft=snippets: