Re: document class
According to your property class - I`ve an approach, but I`m not sure
if I`m on the right track or not. Maybe you could take a look about
it....
CProperty header file:
enum PropType
{
DisplayProp = 1,
NetworkProp = 2,
};
class CProperty
{
public:
CProperty(PropType type)
{
m_network = NULL;
m_display = NULL;
//type: talking to which class
m_type = type;
}
//I need a param which determines which specific value I want to get
CString GetStringValue() const
{
CString value;
switch(m_type)
{
case DisplayProp:
//which options do I have to determine if value should be the
contrast or the brightness ???
value = m_display->GetBrightness();
break;
case NetworkProp:
break;
default:
ASSERT(FALSE);
return (CString());
}
return value;
}
private:
UINT m_iValue;
CString m_sName;
CStringList m_values;
CDisplay* m_display;
CNetwork* m_network;
PropType m_type;
};
class CDisplay
{
public:
CDisplay(void);
~CDisplay(void);
int GetState(){return m_state;}
void SetState(int stat){ m_state = stat;}
//braucht man diese beiden funktionen f=FCr alle drei variablen???
CString GetBrightness(){return m_brightness;}
protected:
CString m_brightness;
CString m_contrast;
UINT m_state;
};
and the access in the dialog class:
void DisplayDialog::OnInitDialog()
{
//
CProperty displayproper(CProperty::DisplayProp);
CString brightness =
displayproper.GetStringValue(DEFINE_GET_BRIGHT)
m_editFieldBright.SetWindowText(brightness);
}
With this solution I need for every value a #define
(DEFINE_GET_BRIGHT) to know which one (string) I want to get by
calling the GetStringValue() method. I`m not sure if there`s a much
better solution. And where do I have to install all these #defines to
be able to access them in the Dialog-class.
Maybe I missunderstood what you mean by a Property class.
As well as it would be great if you could tell me in a few sentences
how you would work with xml files. For example. if you always load and
release the xml file when you get a further query to get some
information from the xml file. Or if you load the xml only at startup,
parse all values and store them in a CMap, CList and then you release
the xml file. And only if the user change the information you will
loaad the xml file again and store these changes iin the xml file.
best regards
Hans