BCS c++ Source Code Generator


When this utility is invaded the source code produced includes a utility class, a main program and all the associated files for en Eclipse c++ project.

The header file for the utility is as follows.
[codesyntax lang=”cpp”]

/**
 * db01h.h
 *
 *  Created on: Aug 28, 2017
 *  @author    Author: archman
 */
#ifndef DB01H_H_
#define DB01H_H_
#include <boost/algorithm/string/replace.hpp>
#include <iostream>
#include <fstream>
#include <string>
#include <string>
using namespace std;
const int sizeOfStringArray = 1000;
/**
 * This is some test Doc Text
 */
class dbc {
/**
 * Private  Declarations Go Here
 */
private:
/**
 * Public  Declarations Go Here
 */
public:
	int fin(string, string[]);
	void fot(string otf, string stv[sizeOfStringArray], int cnt);
	void fileCopy(string fin, string fot);
	bool forceDirectories(string path);
};
#endif /* DB01H_H_ */

[/codesyntax]
The procedure file for the utility is as follows.
[codesyntax lang=”cpp”]

/*
 * db01h.cpp
 *
 *  Created on: Aug 28, 2017
 *      Author: archman
 */
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/algorithm/string.hpp>
#include "db01h.h"
using namespace std;
/**
 *This program designed
 */
void dbc::fileCopy(string fin, string fot) {
	std::ifstream src(fin, std::ios::binary);
	std::ofstream dst(fot, std::ios::binary);
	dst << src.rdbuf();
}
int dbc::fin(string inf, string stv[sizeOfStringArray]) {
	string line;
	int lcnt = 0;
	ifstream myfile(inf);
	if (myfile.is_open()) {
		while (getline(myfile, line)) {
			stv[lcnt] = line + "\n";
			lcnt++;
		}
		myfile.close();
		return lcnt;
	}
	else
		cout << "Unable to open file";
	return lcnt;
}
bool dbc::forceDirectories(string path) {
	boost::filesystem::path dir(path);
	if (!(boost::filesystem::exists(dir))) {
		std::cout << path << " Doesn't Exists" << std::endl;
		if (boost::filesystem::create_directory(dir))
			std::cout << path << " Successfully Created !" << std::endl;
		return true;
	} else {
		return false;
	}
}
void dbc::fot(string otf, string stv[sizeOfStringArray], int cnt) {
	string line;
	int ii = 0;
	ofstream myfile(otf);
	while (ii < cnt) {
		line = stv[ii];
		myfile << line;
		ii++;
	}
	myfile.close();
}

[/codesyntax]
The main program is as follows.
[codesyntax lang=”cpp”]

//============================================================================
// Name        : db01p.cpp
// Author      : Mr. Arch Brooks
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
/*! \mainpage My Personal Index Page
 *
 * \section intro_sec Introduction
 *
 * This is the introduction.
 *
 * \section install_sec Installation
 *
 * \subsection step1 Step 1: Opening the box
 *
 * etc...
 */
#include <iostream>
#include "db01h.h"
using namespace std;
int main(int argc, char* argv[]) {
	Gnome::
	cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
	return 0;
}

[/codesyntax]
 
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply

Your email address will not be published. Required fields are marked *