Objective Edit doesn't have a separate function that performs serialization. However, if you would like to serialize the current font and color settings of the language to the registry, several Objective Edit functions enable saving the settings into the registry in customized ways.
Specify where the language will be saved by calling SECEDIT_REG_WRITER(key).
From then on, anytime you call SECEditLangConfig::WriteLanguage(language), the information will be saved into your registry.
Assume you need to read from a registry with key name KEY1 and you want to write to a registry with key name KEY2 at the end. The language you are using is named Custom. Here's what you can do:
In your CMyApp::InitInstance(), register this language at any point before the ShowWindow() function call:
SECEDIT_REGISTER_LANGUAGE(_T("Custom"), SECEDIT_REG_READER(KEY1), SECEDIT_REG_WRITER(KEY2)); |
To read the information back from the registry, in your Document class
m_Edit.SetLanguage(_T(''Custom'')); |
will invoke reading language from KEY1.
Also
SECEditLangConfig* pLang = static_cast<SECEditLangConfig*>(m_Edit.GetLangPtr()); pLang->WriteLanguage(_T("Custom")); |
will invoke writing language to KEY2.
The second parameter of SECEDIT_REGISTER_LANGUAGE can be any of the Reader macros. (Refer to Table 9.) The third parameter can be any of the Writer macros (Table 8). For example, if you want to read from an .ini file named ''reader.ini'' instead of KEY1, you can say:
SECEDIT_REGISTER_LANGUAGE(_T("Custom"), SECEDIT_INI_READER(_T(''.//reader.ini'')), SECEDIT_REG_WRITER(KEY2)); |
You can also specify that if the registry does not have such entry, it should use your custom language resource/file instead. If you want to specify two sources to read from at the same time, for example, read from file first, if that fails, then read from a registry, you can call one of the combinational macros (Table 10):
SECEDIT_INI_REG_READER(filename, KEY) |
(Use this as the second parameter for SECEDIT_REGISTER_LANGUAGE.)
Other similar macros you may be interested in are:
Writer Macros | Definition |
SECEDIT_INI_WRITER(file) | write to .ini file |
SECEDIT_BIN_WRITER(file) | write to bin |
SECEDIT_REG_WRITER(key) | write to registry |
Reader Macros | Definition |
SECEDIT_INI_READER(file) | read from .ini file |
SECEDIT_BIN_READER(file) | read from bin |
SECEDIT_REG_READER(key) | read from registry |
SECEDIT_RES_READER(resid) | read from resource |
Composite Reader Macros | Definition |
SECEDIT_INI_REG_READER (file,key) | read from .ini first, then registry |
SECEDIT_BIN_REG_READER (file,key) | read bin first, then registry |
SECEDIT_RES_REG_READER (resid,key) | read resource first, then registry |
Obtain more information about using these macros from the SECEditLangConfig.h header file that contains them.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.