Click here to Skip to main content
15,916,462 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralSerializing objects using XLM Pin
Ernesto D.4-Apr-05 15:01
Ernesto D.4-Apr-05 15:01 
GeneralRe: Serializing objects using XLM Pin
Christian Graus4-Apr-05 15:53
protectorChristian Graus4-Apr-05 15:53 
GeneralRe: Serializing objects using XLM Pin
Michael Dunn4-Apr-05 20:15
sitebuilderMichael Dunn4-Apr-05 20:15 
GeneralRe: Serializing objects using XLM Pin
Ernesto D.4-Apr-05 20:20
Ernesto D.4-Apr-05 20:20 
GeneralRe: Serializing objects using XLM Pin
Andrew Walker4-Apr-05 21:13
Andrew Walker4-Apr-05 21:13 
GeneralRe: Serializing objects using XLM Pin
Ernesto D.5-Apr-05 2:34
Ernesto D.5-Apr-05 2:34 
GeneralSmart Tag for Rich Edit of Outlook email viewer Pin
Rajeev K Srivastava3-Apr-05 9:35
Rajeev K Srivastava3-Apr-05 9:35 
GeneralCan't get data from my vector. Help!!! Pin
Larry Mills Sr2-Apr-05 9:42
Larry Mills Sr2-Apr-05 9:42 
I cannot get the data from my vector after I’ve loaded it! It shows in debug that the vector is loading, but I can’t get the data it has loaded out of the vector.

Also, how do I save/load the vector to file. No one explains the file operations for containers that I can find.

Here’s the pertinent code:

#pragma warning(disable: 4786)

#include "stdafx.h"
#include "Well.h"
#include "Leases.h"
//#include "stdafx.h"
//#include "stdafx.h"

using std::cout;
using std::endl;

int main(int argc, char* argv[])
{
cout << "Hello World" << endl << endl;

CLease cleases;
/*
int i = 0;
for(i=0; i<6; i++)
{

cout << nSerialNum << strUseMap << " " << strWellDescription << " " << strWellName << endl; endl;
db::it++;
}
*/
return 0;
}


/* This class will be included in the vector and then saved to the file
*/


#if !defined AFX_WELL_H__
#define AFX_WELL_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "stdafx.h"
#include <string>
//#include <vector>
//#include "Leases.h"
//#include <string>

using std::string;


class CWell {
public:
string& GetWellName2();
string& GetWellDescription2();
string& GetUseMap2();
long GetSerialNum2();
string GetWellName(string& str);
string GetWellDescription(string& str);
string GetUseMap(string& str);
long GetSerialNum(long& SN);
CWell();
virtual ~CWell();
void Initialize();
protected:
string strWellName;
string strWellDescription;
string strUseMap;
long nSerialNum;

// Fuctions of class
// string GetWellName();
// string GetWellDescription();
// string GetUseMapLocation();
// long GetSerialNumber();
};



#endif // !defined AFX_WELL_H__

#include "stdafx.h"
//#include <vector>
#include "Well.h"
//#include <string>

CWell::CWell() {
// This class holds the data for each well
strUseMap = "";
strWellDescription = "";
strWellName = "";
nSerialNum = 0;

}

CWell::~CWell() {

}


// end class

void CWell::Initialize()
{

// Initialize the well class members to 0/NULL
nSerialNum = 0;
strUseMap = "";
strWellDescription = "";
strWellName = "";
}

long CWell::GetSerialNum(long& SN)
{
return nSerialNum = SN;
}

string CWell::GetUseMap(string& str)
{
return strUseMap = str;
}

string CWell::GetWellDescription(string& str)
{
return strWellDescription = str;
}

string CWell::GetWellName(string& str)
{
return strWellName = str;
}

long CWell::GetSerialNum2()
{
return (long)nSerialNum;
}

string& CWell::GetUseMap2()
{
return strUseMap;
}

string& CWell::GetWellDescription2()
{
return strWellDescription;
}

string& CWell::GetWellName2()
{
return strWellName;
}

#if !defined AFX_LEASES_H__
#define AFX_LEASES_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Well.h"

#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
//#include "Well.h"

using std::vector;
using std::iterator;

class CWell;

class CLease {

public:
CLease();
~CLease();


protected:
int nNumOfWells;
std::vector<cwell> db;
std::vector<cwell>::iterator it;
CWell cwells;

};

#endif // end class definition

#include "stdafx.h"
#include "Leases.h"
#include "stdlib.h"

using std::cout;
using std::endl;

CLease::CLease()
{


//CWell cwells = new CWell;
cwells.Initialize();

// For Testing Only : delete after testing is complete
long SN, SN2 = 0;
string str, str2, str3 = "";
int i = 0;
for(i=0; i< 6; i++)
{
switch(i)
{
case 0: SN = 0; SN2 = cwells.GetSerialNum(SN);
str = "1st Use Map"; cwells.GetUseMap(str); str = "";str2 = "";
str = "1st WellDescription"; cwells.GetWellDescription(str); str = "";str2 = "";
str = "1st Well Name"; cwells.GetWellName(str); str = "";str2 = "";
break;
case 1: SN = 1; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "2nd Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "2nd WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "2nd Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 2: SN = 2; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "3rd Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "3rd WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "3rd Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 3: SN = 3; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "4th Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "4th WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "4th Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 4: SN = 4; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "5th Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "5th WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "5th Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 5: SN = 5; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "6th Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "6th WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "6th Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
} // end switch

db.push_back(cwells);
SN = 0;
str = "";
str2 = "";
str3 = "";
} // end for
// now check the container
CWell well;
for(it=db.begin(); it != db.end(); it++)
{
SN = cwells.GetSerialNum2();
str = cwells.GetUseMap2();
str2 = cwelsl.GetWellDescription2();
str3 = cwells.GetWellName2();
cout << SN << " " << str << " " << str2 << " " << str3 << endl;
//cout << *it << endl;
SN = 0;
str = "";
str2 = "";
str3 = "";
} // end for
}


CLease::~CLease()
{

}



C++ is my favorite programming language
GeneralBrowser Helper Object Pin
nmhuy30-Mar-05 21:42
nmhuy30-Mar-05 21:42 
GeneralRe: Browser Helper Object Pin
Nicholas Cardi1-Apr-05 4:00
Nicholas Cardi1-Apr-05 4:00 
GeneralProblem while Persisting Image into Control Pin
ajalilqarshi30-Mar-05 3:58
ajalilqarshi30-Mar-05 3:58 
GeneralMultiple Inclusion Pin
Gomzy29-Mar-05 22:09
sussGomzy29-Mar-05 22:09 
QuestionPlease help. Is multimap what I need? Pin
knapak29-Mar-05 13:37
knapak29-Mar-05 13:37 
AnswerRe: Please help. Is multimap what I need? Pin
Joaquín M López Muñoz30-Mar-05 6:27
Joaquín M López Muñoz30-Mar-05 6:27 
GeneralRe: Please help. Is multimap what I need? Pin
knapak30-Mar-05 11:44
knapak30-Mar-05 11:44 
GeneralCString to &lt;string&gt; help please.. Pin
mlatimer28-Mar-05 19:25
mlatimer28-Mar-05 19:25 
GeneralRe: CString to &lt;string&gt; help please.. Pin
rwestgraham29-Mar-05 14:32
rwestgraham29-Mar-05 14:32 
QuestionHow to Access properties of Control? Pin
ajalilqarshi28-Mar-05 19:01
ajalilqarshi28-Mar-05 19:01 
General[wtl] Making a Wizard-Only app Pin
Member 1219625228-Mar-05 2:12
Member 1219625228-Mar-05 2:12 
GeneralRe: [wtl] Making a Wizard-Only app Pin
Ernesto D.4-Apr-05 14:55
Ernesto D.4-Apr-05 14:55 
Generalcomponents with multiple interfaces Pin
yqzq27-Mar-05 22:14
yqzq27-Mar-05 22:14 
GeneralEvent Threading Pin
zx2c426-Mar-05 16:32
zx2c426-Mar-05 16:32 
GeneralRe: Event Threading Pin
Nicholas Cardi1-Apr-05 4:08
Nicholas Cardi1-Apr-05 4:08 
QuestionIsn't it possible to Persist SAFEARRAYs? Pin
ajalilqarshi25-Mar-05 22:18
ajalilqarshi25-Mar-05 22:18 
AnswerRe: Isn't it possible to Persist SAFEARRAYs? Pin
Michael Dunn26-Mar-05 9:56
sitebuilderMichael Dunn26-Mar-05 9:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.