|
-
December 3rd, 2003, 12:22 PM
#1
Enum Question
Howdy All,
Ok, for starters let clear up the fact that I am somewhat new to C++ and this is my first post, so please bear with me.
Using VC++ 6 MFC
I have 2 classes. A languages class and a settings class. When initialized the languages class is passed a pointer to the Settings class. The pointer is then used to retirieve settings values.
When calling the GetSetting function I am trying to pass an enum. This is were the problem arises. When calling the GetSetting function from CLanguages it says that the enum value is an undeclared iedetifier:
error C2065: 'LanguagePath' : undeclared identifier
Thanks In Advance
Jeremy
Code:
class CLanguages
{
private:
fstream m_LanguageFile;
void OpenLanguageFile(bool Output = FALSE);
CSettings* m_CSettings;
public:
CLanguages(CSettings* Settings);
virtual ~CLanguages();
};
void CLanguages::OpenLanguageFile(bool Output)
{
if (!m_LanguageFile.is_open())
{
if (Output)
m_LanguageFile.open(m_CSettings->GetSetting(LanguagePath), ios::out); //Generates error!
else
m_LanguageFile.open(m_CSettings->GetSetting(LanguagePath), ios::in); //Generates error!
}
}
class CSettings
{
private:
struct structSetting
{
CString Setting;
CString Value;
int ID;
};
CArray <structSetting, structSetting> m_Settings ;
bool m_bSettingsLoaded;
void LoadSettings();
public:
enum SettingID
{
LanguagePath,
ResourceMaster
};
CSettings();
virtual ~CSettings();
CString GetSetting(SettingID ID);
};
CString CSettings::GetSetting(SettingID ID)
{
int idx = 0;
if (!m_bSettingsLoaded)
CSettings::LoadSettings();
for ( idx = 0 ; m_Settings.GetSize (); idx++ )
{
if (m_Settings [idx].ID == ID)
return m_Settings [idx].Value;
}
return "";
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|