Bladeren bron

Modify Class

Etheram68 5 jaren geleden
bovenliggende
commit
d9bf308776
3 gewijzigde bestanden met toevoegingen van 9 en 3 verwijderingen
  1. 1 1
      README.md
  2. 1 1
      package.json
  3. 7 1
      src/extension.ts

+ 1 - 1
README.md

@@ -28,5 +28,5 @@ To report a bug or ask for a feature, please open a [Github issue](https://githu
 
 ## Release Notes
 
-### 0.1.1
+### 0.1.4
 First Version of Auto Create canonical Class for the Cpp language

+ 1 - 1
package.json

@@ -2,7 +2,7 @@
 	"name": "canonicalclasscpp",
 	"displayName": "Canonical Class CPP",
 	"description": "This extension is to automatically create a canonical hpp and cpp file",
-	"version": "0.1.1",
+	"version": "0.1.4",
 	"publisher": "frfreyCanonicalClassCPP",
 	"icon": "42.png",
 	"repository": {

+ 7 - 1
src/extension.ts

@@ -43,7 +43,10 @@ export function activate(context: vscode.ExtensionContext) {
 							name + "::" + name + "() {}\n\n" +
 							name + "::" + name + "( const " + name + " & object ) {}\n\n" +
 							name + "::~" + name + "()\n{\n	std::cout << \"Destructor called\" << std::endl;\n}\n\n" +
-							name + " &		" + name + "::operator=( " + name + " const & rhs )\n{\n	return (*this);\n}\n\n";
+							name + " &		" + name + "::operator=( " + name + " const & rhs )\n{\n	return *this;\n}\n\n" +
+							"std::ostream &		operator<<( std::ostream & o, " + name + " const & i )\n" +
+							"{\n	o << \"Value\" << i.get();\n	return o;\n}\n\n" +
+							"\n/* ************************************************************************** */";
 
 			let classhpp =	"#ifndef " + name.toUpperCase() + "_CLASS" + "_HPP\n" +
 							"# define " + name.toUpperCase() + "_CLASS" + "_HPP\n\n" +
@@ -61,6 +64,9 @@ export function activate(context: vscode.ExtensionContext) {
 							"	private:\n" +
 							"\n" +
 							"};\n\n" +
+							"\n" +
+							"std::ostream &		operator<<( std::ostream & o, " + name + " const & i );"+
+							"\n\n" +
 							"#endif /* *" + star + " " + name.toUpperCase() + "_CLASS_H */";
 			fs.writeFile(filePathCpp.fsPath, classcpp, function (err: any) { if (err) return console.log(err); });
 			fs.writeFile(filePathHpp.fsPath, classhpp, function (err: any) { if (err) return console.log(err); });