📄 config.tex
字号:
off.\membersection{wxConfigBase::\destruct{wxConfigBase}}\label{wxconfigbasedtor}\func{}{\destruct{wxConfigBase}}{\void}Empty but ensures that dtor of all derived classes is virtual.\membersection{wxConfigBase::Create}\label{wxconfigbasecreate}\func{static wxConfigBase *}{Create}{\void}Create a new config object: this function will create the "best"implementation of wxConfig available for the current platform, see commentsnear the definition of wxCONFIG\_WIN32\_NATIVE for details. It returns thecreated object and also sets it as the current one.\membersection{wxConfigBase::DontCreateOnDemand}\label{wxconfigbasedontcreateondemand}\func{void}{DontCreateOnDemand}{\void}Calling this function will prevent {\it Get()} from automatically creating anew config object if the current one is NULL. It might be useful to call itnear the program end to prevent "accidental" creation of a new config object.\membersection{wxConfigBase::DeleteAll}\label{wxconfigbasedeleteall}\func{bool}{DeleteAll}{\void}Delete the whole underlying object (disk file, registry key, ...). Primarlyfor use by uninstallation routine.\membersection{wxConfigBase::DeleteEntry}\label{wxconfigbasedeleteentry}\func{bool}{DeleteEntry}{\param{const wxString\& }{ key}, \param{bool}{ bDeleteGroupIfEmpty = true}}Deletes the specified entry and the group it belongs to if it was the last keyin it and the second parameter is true.\membersection{wxConfigBase::DeleteGroup}\label{wxconfigbasedeletegroup}\func{bool}{DeleteGroup}{\param{const wxString\& }{ key}}Delete the group (with all subgroups). If the current path is under the groupbeing deleted it is changed to its deepest still existing component. E.g. ifthe current path is \texttt{/A/B/C/D} and the group \texttt{C} is deleted thepath becomes \texttt{/A/B}.\membersection{wxConfigBase::Exists}\label{wxconfigbaseexists}\constfunc{bool}{Exists}{\param{wxString\& }{strName}}returns \true if either a group or an entry with a given name exists\membersection{wxConfigBase::Flush}\label{wxconfigbaseflush}\func{bool}{Flush}{\param{bool }{bCurrentOnly = false}}permanently writes all changes (otherwise, they're only written from object'sdestructor)\membersection{wxConfigBase::Get}\label{wxconfigbaseget}\func{static wxConfigBase *}{Get}{\param{bool }{CreateOnDemand = true}}Get the current config object. If there is no current object and{\it CreateOnDemand} is true, creates one(using {\it Create}) unless DontCreateOnDemand was called previously.\membersection{wxConfigBase::GetAppName}\label{wxconfigbasegetappname}\constfunc{wxString}{GetAppName}{\void}Returns the application name.\membersection{wxConfigBase::GetEntryType}\label{wxconfigbasegetentrytype}\constfunc{enum wxConfigBase::EntryType}{GetEntryType}{\param{const wxString\& }{name}}Returns the type of the given entry or {\it Unknown} if the entry doesn'texist. This function should be used to decide which version of Read() shouldbe used because some of wxConfig implementations will complain about typemismatch otherwise: e.g., an attempt to read a string value from an integerkey with wxRegConfig will fail.The result is an element of enum EntryType:\begin{verbatim} enum EntryType { Type_Unknown, Type_String, Type_Boolean, Type_Integer, Type_Float };\end{verbatim}\membersection{wxConfigBase::GetFirstGroup}\label{wxconfigbasegetfirstgroup}\constfunc{bool}{GetFirstGroup}{\param{wxString\& }{str}, \param{long\&}{ index}}Gets the first group.\pythonnote{The wxPython version of this method returns a 3-tupleconsisting of the continue flag, the value string, and the index forthe next call.}\perlnote{In wxPerl this method takes no arguments and returns a 3-elementlist {\tt ( continue, str, index )}.}\membersection{wxConfigBase::GetFirstEntry}\label{wxconfigbasegetfirstentry}\constfunc{bool}{GetFirstEntry}{\param{wxString\& }{str}, \param{long\&}{ index}}Gets the first entry.\pythonnote{The wxPython version of this method returns a 3-tupleconsisting of the continue flag, the value string, and the index forthe next call.}\perlnote{In wxPerl this method takes no arguments and returns a 3-elementlist {\tt ( continue, str, index )}.}\membersection{wxConfigBase::GetNextGroup}\label{wxconfigbasegetnextgroup}\constfunc{bool}{GetNextGroup}{\param{wxString\& }{str}, \param{long\&}{ index}}Gets the next group.\pythonnote{The wxPython version of this method returns a 3-tupleconsisting of the continue flag, the value string, and the index forthe next call.}\perlnote{In wxPerl this method only takes the {\tt index} parameterand returns a 3-element list {\tt ( continue, str, index )}.}\membersection{wxConfigBase::GetNextEntry}\label{wxconfigbasegetnextentry}\constfunc{bool}{GetNextEntry}{\param{wxString\& }{str}, \param{long\&}{ index}}Gets the next entry.\pythonnote{The wxPython version of this method returns a 3-tupleconsisting of the continue flag, the value string, and the index forthe next call.}\perlnote{In wxPerl this method only takes the {\tt index} parameterand returns a 3-element list {\tt ( continue, str, index )}.}\membersection{wxConfigBase::GetNumberOfEntries}\label{wxconfigbasegetnumberofentries}\constfunc{uint }{GetNumberOfEntries}{\param{bool }{bRecursive = false}}\membersection{wxConfigBase::GetNumberOfGroups}\label{wxconfigbasegetnumberofgroups}\constfunc{uint}{GetNumberOfGroups}{\param{bool }{bRecursive = false}}Get number of entries/subgroups in the current group, with or without itssubgroups.\membersection{wxConfigBase::GetPath}\label{wxconfigbasegetpath}\constfunc{const wxString\&}{GetPath}{\void}Retrieve the current path (always as absolute path).\membersection{wxConfigBase::GetVendorName}\label{wxconfigbasegetvendorname}\constfunc{wxString}{GetVendorName}{\void}Returns the vendor name.\membersection{wxConfigBase::HasEntry}\label{wxconfigbasehasentry}\constfunc{bool}{HasEntry}{\param{wxString\& }{strName}}returns \true if the entry by this name exists\membersection{wxConfigBase::HasGroup}\label{wxconfigbasehasgroup}\constfunc{bool}{HasGroup}{\param{const wxString\& }{strName}}returns \true if the group by this name exists\membersection{wxConfigBase::IsExpandingEnvVars}\label{wxconfigbaseisexpandingenvvars}\constfunc{bool}{IsExpandingEnvVars}{\void}Returns \true if we are expanding environment variables in key values.\membersection{wxConfigBase::IsRecordingDefaults}\label{wxconfigbaseisrecordingdefaults}\constfunc{bool}{IsRecordingDefaults}{\void}Returns \true if we are writing defaults back to the config file.\membersection{wxConfigBase::Read}\label{wxconfigbaseread}\constfunc{bool}{Read}{\param{const wxString\& }{key}, \param{wxString*}{ str}}Read a string from the key, returning \true if the value was read. If the keywas not found, {\it str} is not changed.\constfunc{bool}{Read}{\param{const wxString\& }{key}, \param{wxString*}{ str}, \param{const wxString\& }{defaultVal}}Read a string from the key. The default value is returned if the key was notfound.Returns \true if value was really read, \false if the default was used.\constfunc{wxString}{Read}{\param{const wxString\& }{key}, \param{constwxString\& }{defaultVal}}Another version of {\it Read()}, returning the string value directly.\constfunc{bool}{Read}{\param{const wxString\& }{ key}, \param{long*}{ l}}Reads a long value, returning \true if the value was found. If the value wasnot found, {\it l} is not changed.\constfunc{bool}{Read}{\param{const wxString\& }{ key}, \param{long*}{ l},\param{long}{ defaultVal}}Reads a long value, returning \true if the value was found. If the value wasnot found, {\it defaultVal} is used instead.\constfunc{long }{Read}{\param{const wxString\& }{key}, \param{long}{ defaultVal}}Reads a long value from the key and returns it. {\it defaultVal} is returnedif the key is not found.NB: writing{\small\begin{verbatim} conf->Read("key", 0);\end{verbatim}}won't work because the call is ambiguous: compiler can not choose between two{\it Read} functions. Instead, write:{\small\begin{verbatim} conf->Read("key", 0l);\end{verbatim}}\constfunc{bool}{Read}{\param{const wxString\& }{ key}, \param{double*}{ d}}Reads a double value, returning \true if the value was found. If the value wasnot found, {\it d} is not changed.\constfunc{bool}{Read}{\param{const wxString\& }{ key}, \param{double*}{ d}, \param{double}{ defaultVal}}Reads a double value, returning \true if the value was found. If the value wasnot found, {\it defaultVal} is used instead.\constfunc{bool}{Read}{\param{const wxString\& }{ key}, \param{bool*}{ b}}Reads a bool value, returning \true if the value was found. If the value wasnot found, {\it b} is not changed.\constfunc{bool}{Read}{\param{const wxString\& }{ key}, \param{bool*}{ d},\param{bool}{ defaultVal}}Reads a bool value, returning \true if the value was found. If the value wasnot found, {\it defaultVal} is used instead.\pythonnote{In place of a single overloaded method name, wxPythonimplements the following methods:\par\indented{2cm}{\begin{twocollist}\twocolitem{{\bf Read(key, default="")}}{Returns a string.}\twocolitem{{\bf ReadInt(key, default=0)}}{Returns an int.}\twocolitem{{\bf ReadFloat(key, default=0.0)}}{Returns a floating point number.}\end{twocollist}}}\perlnote{In place of a single overloaded method, wxPerl uses:\par\indented{2cm}{\begin{twocollist}\twocolitem{{\bf Read(key, default="")}}{Returns a string}\twocolitem{{\bf ReadInt(key, default=0)}}{Returns an integer}\twocolitem{{\bf ReadFloat(key, default=0.0)}}{Returns a floating point number}\twocolitem{{\bf ReadBool(key, default=0)}}{Returns a boolean}\end{twocollist}}}\membersection{wxConfigBase::RenameEntry}\label{wxconfigbaserenameentry}\func{bool}{RenameEntry}{\param{const wxString\& }{ oldName}, \param{const wxString\& }{ newName}}Renames an entry in the current group. The entries names (both the old andthe new one) shouldn't contain backslashes, i.e. only simple names and notarbitrary paths are accepted by this function.Returns \false if {\it oldName} doesn't exist or if {\it newName} alreadyexists.\membersection{wxConfigBase::RenameGroup}\label{wxconfigbaserenamegroup}\func{bool}{RenameGroup}{\param{const wxString\& }{ oldName}, \param{const wxString\& }{ newName}}Renames a subgroup of the current group. The subgroup names (both the old andthe new one) shouldn't contain backslashes, i.e. only simple names and notarbitrary paths are accepted by this function.Returns \false if {\it oldName} doesn't exist or if {\it newName} alreadyexists.\membersection{wxConfigBase::Set}\label{wxconfigbaseset}\func{static wxConfigBase *}{Set}{\param{wxConfigBase *}{pConfig}}Sets the config object as the current one, returns the pointer to the previouscurrent object (both the parameter and returned value may be NULL)\membersection{wxConfigBase::SetExpandEnvVars}\label{wxconfigbasesetexpandenvvars}\func{void}{SetExpandEnvVars }{\param{bool }{bDoIt = true}}Determine whether we wish to expand environment variables in key values.\membersection{wxConfigBase::SetPath}\label{wxconfigbasesetpath}\func{void}{SetPath}{\param{const wxString\& }{strPath}}Set current path: if the first character is '/', it is the absolute path,otherwise it is a relative path. '..' is supported. If strPath doesn'texist it is created.\membersection{wxConfigBase::SetRecordDefaults}\label{wxconfigbasesetrecorddefaults}\func{void}{SetRecordDefaults}{\param{bool }{bDoIt = true}}Sets whether defaults are recorded to the config file whenever an attempt toread the value which is not present in it is done.If on (default is off) all default values for the settings used by the programare written back to the config file. This allows the user to see what configoptions may be changed and is probably useful only for wxFileConfig.\membersection{wxConfigBase::Write}\label{wxconfigbasewrite}\func{bool}{Write}{\param{const wxString\& }{ key}, \param{const wxString\& }{value}}\func{bool}{Write}{\param{const wxString\& }{ key}, \param{long}{ value}}\func{bool}{Write}{\param{const wxString\& }{ key}, \param{double}{ value}}\func{bool}{Write}{\param{const wxString\& }{ key}, \param{bool}{ value}}These functions write the specified value to the config file and return \true on success.\pythonnote{In place of a single overloaded method name, wxPythonimplements the following methods:\par\indented{2cm}{\begin{twocollist}\twocolitem{{\bf Write(key, value)}}{Writes a string.}\twocolitem{{\bf WriteInt(key, value)}}{Writes an int.}\twocolitem{{\bf WriteFloat(key, value)}}{Writes a floating point number.}\end{twocollist}}}\perlnote{In place of a single overloaded method, wxPerl uses:\par\indented{2cm}{\begin{twocollist}\twocolitem{{\bf Write(key, value)}}{Writes a string}\twocolitem{{\bf WriteInt(key, value)}}{Writes an integer}\twocolitem{{\bf WriteFloat(key, value)}}{Writes a floating point number}\twocolitem{{\bf WriteBool(key, value)}}{Writes a boolean}\end{twocollist}}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -