Ahoj mám celkem problém, který nemohu vyřešit. Poradí někdo?
measure_util.cpp
// **************************************************************
// $Header: d:/dbs/CVSRepository/protetika/protetik/other/measures_util.cpp,v 1.3 2003/05/09 17:42:10 kota Exp $
//
// Implementation of protetik::MeasuresUtil class methods
//
// **************************************************************
#include "holder.h"
#pragma hdrstop
#include "config.h"
#include <vcl.h>
#include "view/bodymeasures_frame.h"
#include "view/handmeasures_frame.h"
#include "view/footmeasures_frame.h"
#include "view/legmeasures_frame.h"
#include "view/varicosemeasures_frame.h"
#include "view/femoralmeasures_frame.h"
namespace protetik
{
MeasuresUtil::MeasuresUtil(Config *config)
: _table()
{
MeasuresDataBase *data;
AnsiString filename;
//
filename = config->getImagePathname("body.bmp");
data = new MeasuresData<TBodyMeasuresFrame>(filename);
_table[Measures::motBody] = data;
//
filename = config->getImagePathname("hand.bmp");
data = new MeasuresData<THandMeasuresFrame>(filename);
_table[Measures::motHand] = data;
//
filename = config->getImagePathname("foot.bmp");
data = new MeasuresData<TFootMeasuresFrame>(filename);
_table[Measures::motFoot] = data;
//
filename = config->getImagePathname("leg.bmp");
data = new MeasuresData<TLegMeasuresFrame>(filename);
_table[Measures::motLeg] = data;
//
filename = config->getImagePathname("varicose.bmp");
data = new MeasuresData<TVaricoseMeasuresFrame>(filename);
_table[Measures::motVaricose] = data;
//
filename = config->getImagePathname("femoral.bmp");
data = new MeasuresData<TFemoralMeasuresFrame>(filename);
_table[Measures::motFemoral] = data;
}
MeasuresUtil::~MeasuresUtil()
{
for (Table::iterator iter = _table.begin(); iter != _table.end(); iter++)
{
MeasuresDataBase *data = iter->second;
delete data;
}
_table.clear();
}
TMeasuresBaseFrame*
MeasuresUtil::getFrame(Measures::ObjectType type)
{
MeasuresDataBase *data = _table[type];
return data->getFrame();
}
TPicture*
MeasuresUtil::getPicture(Measures::ObjectType type)
{
MeasuresDataBase *data = _table[type];
return data->getPicture();
}
} //protetik namespace
Fórum › C / C++
Jak na [C++ Error] E2316
measure_util.h
// **************************************************************
// $Header: d:/dbs/CVSRepository/protetika/protetik/other/measures_util.h,v 1.2 2003/05/09 17:42:10 kota Exp $
//
// Utilities for measures types resolving.
//
// classes:
// protetik::MeasuresUtil
//
// **************************************************************
#ifndef MEASURES_UTIL_H
#define MEASURES_UTIL_H
#include <vcl.h>
#include <map>
#include "holder.h"
#include "other/measures.h"
namespace protetik
{
using namespace kota;
class Config;
class TMeasuresBaseFrame;
/**
* Utilities for measures types resolving.
*/
class MeasuresUtil
{
private:
// types ---------------------------------------------------------------------
class MeasuresDataBase;
typedef std::map<Measures::ObjectType, MeasuresDataBase*> Table;
// Attributes ----------------------------------------------------------------
Table _table;
public:
// Initialization ------------------------------------------------------------
MeasuresUtil(Config *config);
virtual ~MeasuresUtil();
// Public methods ------------------------------------------------------------
/**
* Gets frame for given measures type.
*/
TMeasuresBaseFrame* getFrame(Measures::ObjectType type);
/**
* Gets picture for given measures type.
*/
TPicture* getPicture(Measures::ObjectType type);
private:
// Assistant methods ---------------------------------------------------------
void loadTable();
// Inner classes /////////////////////////////////////////////////////////////
class MeasuresDataBase
{
public:
virtual ~MeasuresDataBase() {};
virtual TMeasuresBaseFrame* getFrame() = 0;
virtual TPicture* getPicture() = 0;
}; //MeasuresDataBase class
template <class frameType>
class MeasuresData
: public MeasuresDataBase
{
private:
// attributes ----
AnsiString _imageFilename;
ComponentHolder<frameType> _frame;
InitializerHolder<TPicture> _picture;
public:
MeasuresData(const AnsiString &imageFilename)
: MeasuresDataBase(),
_imageFilename(imageFilename),
_frame(NULL),
_picture(&createPicture)
{}
TMeasuresBaseFrame* getFrame()
{
frameType *result = _frame.getObject();
result->value = NULL;
return result;
}
TPicture* getPicture() {
return _picture.getObject();
}
private:
TPicture* createPicture()
{
TPicture *result = new TPicture();
result->LoadFromFile(_imageFilename);
return result;
}
}; //MeasuresData inner class
}; //MeasuresUtil class
} //protetik namespace
#endif //MEASURES_UTIL_H
[C++ Error] measures_util.cpp(24): E2316 'MeasuresUtil::MeasuresUtil(Config *)' is not a member of 'MeasuresUtil'
[C++ Error] measures_util.cpp(56): E2316 'MeasuresUtil::~MeasuresUtil()' is not a member of 'MeasuresUtil'
[C++ Error] measures_util.cpp(68): E2316 'MeasuresUtil::getFrame(Measures::ObjectType)' is not a member of 'MeasuresUtil'
[C++ Error] measures_util.cpp(76): E2316 'MeasuresUtil::getPicture(Measures::ObjectType)' is not a member of 'MeasuresUtil'
Nemůžu sice moc sloužit, protože C++ v tuhle chvíli není moje doména, ale pokusím se jen tipnout, pravděpodobně to bude ale hloupost :-) . Tzn. - není potřeba v tom measures_util.cpp udělat něco jako include "measures_util.h" ?
To MZetko : kurna ja sem si rikal ze to musi jet a ze nejspis nema ty deklarace v necem spravne.. ale kdyz sem koukal na to .h tak me nenapadlo ze zapomene include :smile19:
Přidej příspěvek
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
Uživatelé prohlížející si toto vlákno
Podobná vlákna
Indentation error - jak obecně řešit — založil Martin
QT error: Error code 62097 — založil QtProgramming
Error — založil Ondřej Šplíchal
Moderátoři diskuze