rvctext.h

Go to the documentation of this file.
00001 /**
00002  * \file rvctext.h <mi32/rvctext.h>
00003  * \brief Definitions for RVC TEXT objects
00004  *
00005  * \if NODOC
00006  * $Id: rvctext.h_v 1.22 2004/03/11 17:31:47 mju Exp $
00007  *
00008  * $Log: rvctext.h_v $
00009  * Revision 1.22  2004/03/11 17:31:47  mju
00010  * Remove unused legacy obj selection dialog.
00011  *
00012  * Revision 1.21  2003/10/15 17:39:39  mju
00013  * Deprecate groupkey.
00014  *
00015  * Revision 1.20  2003/09/15 13:49:56  fileserver!dwilliss
00016  * Doxygen
00017  *
00018  * Revision 1.19  2003/08/27 21:32:27  scowan
00019  * Removed functions to get linked file and other deprecated functions.
00020  *
00021  * Revision 1.18  2002/08/20 15:07:00  mju
00022  * Use prevent_memfunc().
00023  *
00024  * Revision 1.17  2002/05/08 22:03:37  scowan
00025  * Nothing.
00026  *
00027  * Revision 1.16  2002/03/27 15:33:05  mju
00028  * Remove MfPrintf functions except when compiling DLL.
00029  *
00030  * Revision 1.15  2002/03/11 18:15:35  scowan
00031  * Added methods a deprecated mem... functions.
00032  *
00033  * Revision 1.14  2001/09/14 14:58:40  mju
00034  * No Mdlg in win32native.
00035  *
00036  * Revision 1.13  2000/11/22 22:46:55  scowan
00037  * Add function to support wrapper class.
00038  *
00039  * Revision 1.12  2000/10/30 21:56:20  msmith
00040  * Genitor documentation.
00041  *
00042  * Revision 1.11  2000/08/24 21:47:51  scowan
00043  * *** empty log message ***
00044  *
00045  * Revision 1.10  2000/06/02 14:43:27  mju
00046  * Use const and default flags in MfTextWriteAll().
00047  *
00048  * Revision 1.9  2000/05/08 14:14:02  mju
00049  * Remove MfSeek/TellText prototypes except when compiling DLL.
00050  *
00051  * Revision 1.8  2000/03/29 03:27:28  scowan
00052  * Added assignment operators.
00053  *
00054  * Revision 1.7  2000/03/16 22:13:16  scowan
00055  * More const.
00056  *
00057  * Revision 1.6  1999/11/19 14:27:33  mju
00058  * MdlgGet... prompt const.
00059  *
00060  * Revision 1.5  1999/10/20  21:07:17  mju
00061  * Use const in WriteText fns.
00062  *
00063  * Revision 1.4  1999/10/05  22:48:42  scowan
00064  * Changed headers to use inheritance.
00065  *
00066  * Revision 1.3  1999/07/26 17:08:30  scowan
00067  * Added link file retrieve function.
00068  *
00069  * Revision 1.2  1999/06/14 13:34:54  mju
00070  * Add MdlgGetTextObject.
00071  *
00072  * Revision 1.1  1999/05/07  21:23:48  mju
00073  * Initial revision
00074  *
00075  * \endif
00076 **/
00077 
00078 #ifndef  INC_MI32_RVCTEXT_H
00079 #define  INC_MI32_RVCTEXT_H
00080 
00081 #ifndef  INC_MI32_RVCDEFNS_H
00082    #include <mi32/rvcdefns.h>
00083 #endif
00084 
00085 //! Forward Declaration
00086 class MISTRING;
00087 
00088 //! Text info class.
00089 struct RVCTEXTINFO : public RVCGENINFO {
00090    UINT8 IsUnicode;                    //!< Unicode text
00091    UINT8 IsLink;                       //!< Link text
00092    #ifndef GENERATING_DOXYGEN_OUTPUT
00093    UINT8 spare_text[6];
00094    #endif //!< GENERATING_DOXYGEN_OUTPUT
00095    
00096    RVCTEXTINFO (
00097       ) {Clear();}
00098    
00099    RVCTEXTINFO (
00100       const RVCGENINFO& ginfo
00101       ) {Clear();*static_cast<RVCGENINFO*>(this) = ginfo;}
00102    
00103    RVCTEXTINFO& operator= (
00104       const RVCGENINFO& ginfo          //!< Text info class to copy from
00105       ) {*static_cast<RVCGENINFO*>(this) = ginfo; return (*this);}
00106       
00107    void Clear (
00108       ) {memset(static_cast<void*>(this), 0, sizeof(*this));}
00109    
00110    };
00111 
00112 PREVENT_MEMFUNC(RVCTEXTINFO)
00113 
00114 //! Query info class.
00115 struct RVCQUERYINFO : public RVCTEXTINFO {
00116    UINT32 usage;                       //!< 1 if this is for a computed field
00117    UINT32 field;                       //!< Which field is this for?
00118    
00119    RVCQUERYINFO (
00120       ) {Clear();}
00121    
00122    RVCQUERYINFO (
00123       const RVCGENINFO& ginfo
00124       ) {Clear();*static_cast<RVCGENINFO*>(this) = ginfo;}
00125    
00126    RVCQUERYINFO& operator= (
00127       const RVCGENINFO& ginfo          //!< Query info class to copy from
00128       ) {*static_cast<RVCGENINFO*>(this) = ginfo; return (*this);}
00129       
00130    void Clear (
00131       ) {memset(static_cast<void*>(this), 0, sizeof(*this));}
00132    
00133    };
00134 
00135 PREVENT_MEMFUNC(RVCQUERYINFO)
00136 
00137 //! Read query header.
00138 inline int MfReadQueryHeader (
00139    int fhandle,                        //!< Open file handle
00140    RVCINODENUM inode,                  //!< Object inode
00141    RVCQUERYINFO* info                  //!< Query header passed / returned
00142    ) {
00143    return (_MfReadHeader(fhandle,inode,info,sizeof(RVCQUERYINFO),RVCCONV_QueryInfo));
00144    }
00145 
00146 //! Write query header.
00147 inline int MfWriteQueryHeader (
00148    int fhandle,                        //!< Open file handle
00149    RVCINODENUM inode,                  //!< Object inode
00150    RVCQUERYINFO* info                  //!< Query header to write
00151    ) {
00152    return (_MfWriteHeader(fhandle,inode,info,sizeof(RVCQUERYINFO),RVCCONV_QueryInfo));
00153    }
00154 
00155 extern "C" {
00156    //! Main level function to close opened text objects.
00157    RVCAPPLIBEXPORT int MfCloseText (
00158       int id,                          //!< Handle returned by MfOpenText()
00159       RVCTEXTINFO *info,               //!< Any header containing RVCTEXTINFO
00160       int isize,                       //!< Size of object header
00161       int hdrtype                      //!< RVCCONV_????
00162       );
00163    
00164    //! Main level function to make text objects.
00165    //!
00166    //! @returns: text object handle > 0 or error < 0
00167    //! If the "IsUnicode" flag is set in the header, the object will contain
00168    //! 2-byte Unicode text.  
00169    //! See Also: MfOpenText()
00170    RVCAPPLIBEXPORT int MfMakeText (
00171       int findex,                      //!< File handle returned by MfOpenFile()
00172       RVCTEXTINFO *info,               //!< Any header containing RVCTEXTINFO
00173       int isize,                       //!< Size of object header
00174       int hdrtype                      //!< RVCCONV_????
00175       );
00176    
00177    //! Main level function to open text objects
00178    //!
00179    //! @returns: text object handle > 0 or error < 0
00180    //! If the "IsUnicode" flag is set in the header, the object contains
00181    //! 2-byte Unicode text.  
00182    //! See Also: MfCloseText(), MfReadText(), MfReadTextUnicode(), MfReadTextLine()
00183    //!   MfReadTextLineUnicode(), MfWriteText(), MfWriteTextLine(), MfWriteTextUnicode()
00184    //!   MfSeekText(), MfTellText(), MfTruncateText(), MfTextLength(), MfTextIsUnicode()
00185    //!   MfReadTextIni(), MfTextReadAll()
00186    //!   MfTextWriteAll(), MfTextMakeLink()
00187    RVCAPPLIBEXPORT int MfOpenText (
00188       int fileindex,                   //!< File handle returned by MfOpenFile()
00189       INT32 inode,                     //!< Generic object inode to open
00190       RVCTEXTINFO *info,               //!< Any header containing RVCTEXTINFO
00191       int isize,                       //!< Size of object header structure
00192       int hdrtype,                     //!< Conversion type: RVCCONV_????
00193       UINT32 flags                     //!< Requires an RVCMODE_Write for writing
00194       );
00195 
00196    //! Read a buffer from a text object (ASCII).
00197    //!
00198    //! @return number of characters read or error < 0 R_ReadPastEnd if no more to read.
00199    //! If the object contains 2-Byte Unicode text, any character > 255 will be converted to 127.
00200    RVCAPPLIBEXPORT INT32 MfReadText (
00201       int id,                          //!< Handle returned by MfMakeText or MfOpenText
00202       char *ptr,                       //!< Buffer to read into
00203       INT32 len                        //!< Number of characters to read
00204       );
00205    
00206    //! Read a text object to an in memory Ini buffer.
00207    RVCAPPLIBEXPORT int MfReadTextIni (
00208       int findex,                      //!< Open RVC file handle
00209       INT32 inode,                     //!< Inode of text object
00210       RVCTEXTINFO *info,               //!< Text object info or DispParm object info header
00211       int isize,                       //!< Size of header
00212       int hdrtype,                     //!< Header conversion type
00213       INIHANDLE handle                 //!< In memory Ini handle from IniOpen()
00214       );
00215    
00216    //! Read a line from a text object (ASCII).
00217    //!
00218    //! @returns number of characters read or error < 0 R_ReadPastEnd if no more to read.
00219    //! This function will read up (and including) the next newline ('\n')
00220    //! character or to the end of the object, or maxlen characters, which
00221    //! ever comes first.  The buffer will always be NULL-terminated.
00222    //! If the object contains 2-Byte Unicode text, any character > 255 will
00223    //! be converted to 127.
00224    RVCAPPLIBEXPORT INT32 MfReadTextLine (
00225       int id,                          //!< Handle returned by MfMakeText or MfOpenText
00226       INT32 maxlen,                    //!< Maximum number of characters to read
00227       char *ptr                        //!< Buffer to read into
00228       );
00229    
00230    //! Read a line from a text object (Unicode).
00231    //!
00232    //! @returns number of characters read or error < 0 R_ReadPastEnd if no more to read.
00233    //! This function will read up (and including) the next newline ('\n')
00234    //! character or to the end of the object, or maxlen characters, which
00235    //! ever comes first.  If the object contains 1-byte ASCII text, all characters will be
00236    //! promoted to Unicode characters in the range 0 to 255.
00237    RVCAPPLIBEXPORT INT32 MfReadTextLineString (
00238       int id,                          //!< Handle returned by MfMakeText or MfOpenText
00239       MISTRING& string                 //!< String to read into
00240       );
00241    
00242    //! Read a line from a text object (Unicode).
00243    //!
00244    //! @returns number of characters read or error < 0 R_ReadPastEnd if no more to read.
00245    //! This function will read up (and including) the next newline ('\n')
00246    //! character or to the end of the object, or maxlen characters, which
00247    //! ever comes first.  The buffer will always be NULL-terminated.
00248    //! If the object contains 1-byte ASCII text, all characters will be
00249    //! promoted to Unicode characters in the range 0 to 255.
00250    RVCAPPLIBEXPORT INT32 MfReadTextLineUnicode (
00251       int id,                          //!< Handle returned by MfMakeText or MfOpenText
00252       INT32 maxlen,                    //!< Maximum number of characters (not bytes) to read
00253       UNICODE *ptr                     //!< Buffer to read into
00254       );
00255    
00256    //! Read a line from a text object (Unicode).
00257    //!
00258    //! @returns number of characters read or error < 0 R_ReadPastEnd if no more to read.
00259    //! This function will read up (and including) the next newline ('\n')
00260    //! character or to the end of the object, or maxlen characters, which
00261    //! ever comes first.  If the object contains 1-byte ASCII text, all characters will be
00262    //! promoted to Unicode characters in the range 0 to 255.
00263    RVCAPPLIBEXPORT INT32 MfReadTextString (
00264       int id,                          //!< Handle returned by MfMakeText or MfOpenText
00265       MISTRING& string,                //!< String to read into
00266       INT32 maxlen                     //!< Maximum number of characters (not bytes) to read
00267       );
00268    
00269    //! Read a buffer from a text object (Unicode).
00270    //!
00271    //! @returns number of characters read or error < 0 R_ReadPastEnd if no more to read.
00272    //! If the object contains 1-byte ASCII text, all characters will be
00273    //! promoted to Unicode characters in the range 0 to 255.
00274    RVCAPPLIBEXPORT INT32 MfReadTextUnicode (
00275       int id,                          //!< Handle returned by MfMakeText or MfOpenText
00276       UNICODE *uc,                     //!< Buffer to read into
00277       INT32 len                        //!< Number of characters (not bytes) to read
00278       );
00279    
00280    //! Main level function to return if the text object is in UNICODE.
00281    //!
00282    //! @return true if the text object is in UNICODE, false if not
00283    RVCAPPLIBEXPORT int MfTextIsUnicode(
00284       int id                           //!< Handle returned by MfMakeText or MfOpenText
00285       );
00286    
00287    //! Make a link to an external text file with a text object.
00288    RVCAPPLIBEXPORT int MfTextMakeLink (
00289       int findex,                      //!< File handle returned by MfOpenFile()
00290       RVCTEXTINFO *info,               //!< Any header containing RVCTEXTINFO
00291       int isize,                       //!< Size of object header
00292       int hdrtype,                     //!< RVCCONV_????
00293       const UNICODE *filename,         //!< Name of file to link to
00294       const char *encstr               //!< File encoding string, must be less than 64 bytes
00295       );
00296    
00297    //! Read complete text object into a UNICODE buffer.
00298    RVCAPPLIBEXPORT int MfTextReadAll (
00299       int fhandle,                     //!< File handle returned by MfOpenFile()
00300       INT32 inode,                     //!< Inode of text object to read
00301       RVCTEXTINFO *info,               //!< Any header containing RVCTEXTINFO
00302       int isize,                       //!< Size of object header
00303       int hdrtype,                     //!< RVCCONV_????
00304       UNICODE **buf,                   //!< Buffer to allocate and read into, free by using MfFree()
00305       UINT32 flags                     //!< Flags, see MfOpenText
00306       );
00307    
00308    //! Write complete text object from a UNICODE buffer.
00309    RVCAPPLIBEXPORT int MfTextWriteAll (
00310       int fhandle,                     //!< File handle returned by MfOpenFile()
00311       INT32 inode,                     //!< Inode of text object to read
00312       RVCTEXTINFO *info,               //!< Any header containing RVCTEXTINFO
00313       int isize,                       //!< Size of object header
00314       int hdrtype,                     //!< RVCCONV_????
00315       const UNICODE *buf,              //!< Buffer to write from
00316       UINT32 flags = 0                 //!< Flags, see MfOpenText
00317       );
00318    
00319    //! Resize test object to new length.
00320    RVCAPPLIBEXPORT int MfTruncateText (
00321       int id,                          //!< Handle from MfOpenText() or MfMakeText()
00322       INT32 size                       //!< New length to set it to
00323       );
00324    
00325    //! Write a buffer to a text object (ASCII).
00326    //!
00327    //! @return number of characters written or error < 0
00328    //! If the object contains 2-byte Unicode text, all characters will be
00329    //! promoted to Unicode characters in the range 0 to 255.
00330    RVCAPPLIBEXPORT INT32 MfWriteText (
00331       int id,                          //!< Handle returned by MfMakeText or MfOpenText
00332       const char *ptr,                 //!< Buffer to write
00333       INT32 len                        //!< Number of characters to write
00334       );
00335    
00336    //! Write an in memory Ini buffer to a text object.
00337    //!
00338    //! @return error code if < 0, succesful if 0
00339    //! NOTE: If new object, these fields in the 'info' parameter must be set:
00340    //!      name, desc, source, parentinode, objtype
00341    RVCAPPLIBEXPORT int MfWriteTextIni (
00342       int findex,                      //!< Open RVC file handle
00343       INT32 inode,                     //!< Inode of text object, -1 if new, info.parentinode must be set
00344       RVCTEXTINFO *info,               //!< Text object info or DispParm object info header
00345       int isize,                       //!< Size of header
00346       int hdrtype,                     //!< Header conversion type
00347       INIHANDLE handle                 //!< In memory Ini handle from IniOpen()
00348       );
00349    
00350    //! Write a line to a text object (ASCII).
00351    //!
00352    //! @return number of characters written or error < 0
00353    //! If the object contains 2-byte Unicode text, all characters will be
00354    //! promoted to Unicode charactLineUnicode      Write a line to a text object (Unicode)
00355    RVCAPPLIBEXPORT INT32 MfWriteTextLine (
00356       int id,                          //!< Handle returned by MfMakeText or MfOpenText
00357       const char *ptr                  //!< NULL-terminated buffer to write
00358       );
00359    
00360    //! Write a line to a text object (ASCII).
00361    //!
00362    //! @return number of characters written or error < 0
00363    //! If the object contains 1-Byte ASCII text, any character > 255 will
00364    //! be converted to 127 before being written out.
00365    RVCAPPLIBEXPORT INT32 MfWriteTextLineUnicode (
00366       int id,                          //!< Handle returned by MfMakeText or MfOpenText
00367       const UNICODE *us                //!< NULL-terminated buffer to write
00368       );
00369    
00370    //! Write a buffer to a text object (Unicode).
00371    //!
00372    //! @return number of characters written or error < 0
00373    //! If the object contains 1-Byte ASCII text, any character > 255 will
00374    //! be converted to 127 before being written out.
00375    RVCAPPLIBEXPORT INT32 MfWriteTextUnicode (
00376       int id,                          //!< Handle returned by MfMakeText or MfOpenText
00377       const UNICODE *uc,               //!< Buffer to write
00378       INT32 len                        //!< Number of characters (not bytes) to write
00379       );
00380 
00381    }
00382 
00383 #endif   //!< INC_MI32_RVCTEXT_H

Generated on Tue Dec 14 13:18:36 2004 for TNTsdk by  doxygen 1.3.8-20040913