newly added. Not for productive used yetsvn diff | grep Index:
This commit is contained in:
36
src/tests/stl_check_2/PPointObj.cpp
Normal file
36
src/tests/stl_check_2/PPointObj.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include "PPointObj.h"
|
||||
|
||||
#define PPO_SIZE 100
|
||||
|
||||
PPointObj::PPointObj(unsigned int counter) : fCounter(counter)
|
||||
{
|
||||
fTest = new int[PPO_SIZE];
|
||||
|
||||
for (unsigned int i=0; i<PPO_SIZE; i++)
|
||||
fTest[i] = 2*PPO_SIZE*counter+i;
|
||||
|
||||
cout << endl << "in PPointObj() " << fCounter << ": fTest = " << fTest;
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
PPointObj::~PPointObj()
|
||||
{
|
||||
if (fTest) {
|
||||
delete [] fTest;
|
||||
fTest = 0;
|
||||
}
|
||||
|
||||
cout << endl << "in ~PPointObj() " << fCounter << ": fTest = " << fTest;
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
void PPointObj::PrintTest()
|
||||
{
|
||||
cout << endl << fCounter << ": ";
|
||||
for (unsigned int i=0; i<PPO_SIZE; i++)
|
||||
cout << fTest[i] << ", ";
|
||||
cout << endl;
|
||||
}
|
||||
16
src/tests/stl_check_2/PPointObj.h
Normal file
16
src/tests/stl_check_2/PPointObj.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef _PPOINTOBJ_H_
|
||||
#define _PPOINTOBJ_H_
|
||||
|
||||
class PPointObj {
|
||||
public:
|
||||
PPointObj(unsigned int counter);
|
||||
~PPointObj();
|
||||
|
||||
void PrintTest();
|
||||
|
||||
private:
|
||||
int fCounter;
|
||||
int *fTest;
|
||||
};
|
||||
|
||||
#endif // _PPOINTOBJ_H_
|
||||
29
src/tests/stl_check_2/PStlCheck.cpp
Normal file
29
src/tests/stl_check_2/PStlCheck.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "PStlCheck.h"
|
||||
|
||||
PStlCheck::PStlCheck()
|
||||
{
|
||||
}
|
||||
|
||||
PStlCheck::~PStlCheck()
|
||||
{
|
||||
fPpo.clear();
|
||||
}
|
||||
|
||||
void PStlCheck::Add(unsigned int count)
|
||||
{
|
||||
fPpo.push_back(new PPointObj(count));
|
||||
}
|
||||
|
||||
void PStlCheck::CleanUp()
|
||||
{
|
||||
for (unsigned int i=0; i<fPpo.size(); i++) {
|
||||
fPpo[i]->~PPointObj();
|
||||
}
|
||||
}
|
||||
|
||||
void PStlCheck::PrintTest()
|
||||
{
|
||||
for (unsigned int i=0; i<fPpo.size(); i++)
|
||||
fPpo[i]->PrintTest();
|
||||
}
|
||||
|
||||
22
src/tests/stl_check_2/PStlCheck.h
Normal file
22
src/tests/stl_check_2/PStlCheck.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef _PSTLCHECK_H_
|
||||
#define _PSTLCHECK_H_
|
||||
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
#include "PPointObj.h"
|
||||
|
||||
class PStlCheck {
|
||||
public:
|
||||
PStlCheck();
|
||||
~PStlCheck();
|
||||
|
||||
void Add(unsigned int count);
|
||||
void CleanUp();
|
||||
void PrintTest();
|
||||
|
||||
private:
|
||||
vector<PPointObj*> fPpo;
|
||||
};
|
||||
|
||||
#endif // _PSTLCHECK_H_
|
||||
21
src/tests/stl_check_2/stl_check_2.cpp
Normal file
21
src/tests/stl_check_2/stl_check_2.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
#include "PStlCheck.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
PStlCheck check;
|
||||
|
||||
for (unsigned int i=0; i<2; i++) {
|
||||
check.Add(i);
|
||||
cout << endl << "----------";
|
||||
}
|
||||
|
||||
check.PrintTest();
|
||||
|
||||
check.CleanUp();
|
||||
|
||||
return 0;
|
||||
}
|
||||
22
src/tests/stl_check_2/stl_check_2.pro
Normal file
22
src/tests/stl_check_2/stl_check_2.pro
Normal file
@@ -0,0 +1,22 @@
|
||||
#------------------------------------------------------
|
||||
# stl_check_2.pro
|
||||
# qmake file for stl_check_2
|
||||
#
|
||||
# Andreas Suter, 2007/05/14
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
#------------------------------------------------------
|
||||
|
||||
MAKEFILE = Makefile.stl_check_2
|
||||
|
||||
CONFIG += warn_on debug
|
||||
|
||||
HEADERS = PStlCheck.h \
|
||||
PPointObj.h
|
||||
|
||||
SOURCES = stl_check_2.cpp \
|
||||
PStlCheck.cpp \
|
||||
PPointObj.cpp
|
||||
|
||||
TARGET=stl_check_2
|
||||
Reference in New Issue
Block a user