To make development with the dtSearch Engine easier, a small collection of classes is provided to simplify the function-call API.
The classes are not compiled into the dtSearch Engine DLL, and instead are provided as C++ source files and also as a static library that you can include in your project.
An optional macro, USE_DTSEARCH_NAMESPACE, will place all of the C++ Support Classes into a namespace named "dtSearch".
To include the static library version of the classes in your project:
1. Tell the compiler where to find the dtSearch .lib and .h files. To do this, add the dtSearch Engine LIB folder to the library path and add the dtSearch Engine examples\cpp\include folder to the "include" path. In Visual C++, click Tools > Options > Directories to access these settings.
2. #include <dtsfclib.h> in the source code modules that use the dtSearch Engine.
Four versions of the static library are included: Release, Debug, Unicode Release, and Unicode Debug. The dtsfclib.h header will automatically select the correct version for your configuration.
To use the pre-built static libraries, your project must
1. use MFC 7.1 (the version included with Visual Studio .NET 2003) or MFC 8 (the version included with Visual Studio .NET 2005 SP 1);
2. be built with MFC support and with the multithreaded DLL version of the runtime library;
3. be built with the option to make wchar_t a built-in type (Project properties > C/C++ > Language > Treat wchar_t as Built-in Type);
4. use the new streams (#include <fstream>, not #include <fstream.h>), if the project
uses iostreams; and
5. #define the USE_DTSEARCH_NAMESPACE macro.
If your project is not compatible with these assumptions, you can still use the C++ Support Classes, but you will need to include them as source code. (The static libraries
are built by the project in the examples\cpp\dtsfclib folder, so you can also build custom versions of the static libraries.)
To include the source code version of the C++ support classes in a C++ project:
1. Tell the compiler where to find the dtSearch .lib and .h files. To do this, add the dtSearch Engine LIB folder to the library path and add the dtSearch Engine examples\cpp\include folder to the "include" path. In Visual C++ 6, click Tools > Options > Directories to access these settings.
2. Add dten600.lib to the project.
3. Add dtsearch.cpp, dtsviewr.cpp, dstring.cpp, dfile.cpp, dinputstream.cpp, and dtsfc.cpp to the project. These files are located in the dtSearch Engine examples\cpp\common folder.
4. #include <dtsfc.h> in source code modules that use the classes, or add dtsfc.h to your stdafx.h
The "Job" classes -- DFileConvertJob, DIndexJob, DIndexMergeJob, DIndexListJob, DSearchJob, and DSearchReportJob -- all inherit basic job control functions from DJobBase. For information on starting, monitoring, or cancelling a job, and on obtaining error information on a job that has completed, see the DJobBase documentation.
The DStringProperty and DStringSetProperty classes are used extensively in the Job classes to provide easy access to string and string set values passed to or from the dtSearch Engine. The advantage of these classes over the char * pointers used in the lower-level function-call interface is that the DStringProperty and DStringSetProperty classes take care of all character set conversion issues, so that values can be set or read as Ansi, Unicode, or UTF-8 (the format the dtSearch Engine uses internally).
Some API functions return variable-length string data as a dtsStringHandle. To transfer this string data to a DString and release the dtsStringHandle object in a single step, call DString's getFromStringHandle function.
|
Namespace |
Description |
|
Namespace for C++ support classes. The namespace is conditionally included in header files if USE_DTSEARCH_NAMESPACE is defined |
|
Copyright (c) 1995-2008 dtSearch Corp. All rights reserved.
|