Blame libdjvu/Template.h

Packit df99a1
//C-  -*- C++ -*-
Packit df99a1
//C- -------------------------------------------------------------------
Packit df99a1
//C- DjVuLibre-3.5
Packit df99a1
//C- Copyright (c) 2002  Leon Bottou and Yann Le Cun.
Packit df99a1
//C- Copyright (c) 2001  AT&T
Packit df99a1
//C-
Packit df99a1
//C- This software is subject to, and may be distributed under, the
Packit df99a1
//C- GNU General Public License, either Version 2 of the license,
Packit df99a1
//C- or (at your option) any later version. The license should have
Packit df99a1
//C- accompanied the software or you may obtain a copy of the license
Packit df99a1
//C- from the Free Software Foundation at http://www.fsf.org .
Packit df99a1
//C-
Packit df99a1
//C- This program is distributed in the hope that it will be useful,
Packit df99a1
//C- but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit df99a1
//C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit df99a1
//C- GNU General Public License for more details.
Packit df99a1
//C- 
Packit df99a1
//C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library from
Packit df99a1
//C- Lizardtech Software.  Lizardtech Software has authorized us to
Packit df99a1
//C- replace the original DjVu(r) Reference Library notice by the following
Packit df99a1
//C- text (see doc/lizard2002.djvu and doc/lizardtech2007.djvu):
Packit df99a1
//C-
Packit df99a1
//C-  ------------------------------------------------------------------
Packit df99a1
//C- | DjVu (r) Reference Library (v. 3.5)
Packit df99a1
//C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
Packit df99a1
//C- | The DjVu Reference Library is protected by U.S. Pat. No.
Packit df99a1
//C- | 6,058,214 and patents pending.
Packit df99a1
//C- |
Packit df99a1
//C- | This software is subject to, and may be distributed under, the
Packit df99a1
//C- | GNU General Public License, either Version 2 of the license,
Packit df99a1
//C- | or (at your option) any later version. The license should have
Packit df99a1
//C- | accompanied the software or you may obtain a copy of the license
Packit df99a1
//C- | from the Free Software Foundation at http://www.fsf.org .
Packit df99a1
//C- |
Packit df99a1
//C- | The computer code originally released by LizardTech under this
Packit df99a1
//C- | license and unmodified by other parties is deemed "the LIZARDTECH
Packit df99a1
//C- | ORIGINAL CODE."  Subject to any third party intellectual property
Packit df99a1
//C- | claims, LizardTech grants recipient a worldwide, royalty-free, 
Packit df99a1
//C- | non-exclusive license to make, use, sell, or otherwise dispose of 
Packit df99a1
//C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the 
Packit df99a1
//C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU 
Packit df99a1
//C- | General Public License.   This grant only confers the right to 
Packit df99a1
//C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to 
Packit df99a1
//C- | the extent such infringement is reasonably necessary to enable 
Packit df99a1
//C- | recipient to make, have made, practice, sell, or otherwise dispose 
Packit df99a1
//C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to 
Packit df99a1
//C- | any greater extent that may be necessary to utilize further 
Packit df99a1
//C- | modifications or combinations.
Packit df99a1
//C- |
Packit df99a1
//C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
Packit df99a1
//C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
Packit df99a1
//C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
Packit df99a1
//C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Packit df99a1
//C- +------------------------------------------------------------------
Packit df99a1
Packit df99a1
//T// This is a template for the header files in the
Packit df99a1
//T// DjVu reference library. It describes the general
Packit df99a1
//T// conventions as well as the documentation. 
Packit df99a1
//T// Comments prefixed with '//T//' explain the template
Packit df99a1
//T// features and should be removed.
Packit df99a1
Packit df99a1
#ifndef _TEMPLATE_H_
Packit df99a1
#define _TEMPLATE_H_
Packit df99a1
#ifdef HAVE_CONFIG_H
Packit df99a1
#include "config.h"
Packit df99a1
#endif
Packit df99a1
#if NEED_GNUG_PRAGMAS
Packit df99a1
# pragma interface
Packit df99a1
#endif
Packit df99a1
Packit df99a1
//T// Always include "DjVuGlobal.h"
Packit df99a1
#include "DjVuGlobal.h"
Packit df99a1
Packit df99a1
//T// Other include files
Packit df99a1
#include <string.h>
Packit df99a1
#include "GException.h"
Packit df99a1
Packit df99a1
//T// Begin name space
Packit df99a1
Packit df99a1
#ifdef HAVE_NAMESPACES
Packit df99a1
namespace DJVU {
Packit df99a1
# ifdef NOT_DEFINED // Just to fool emacs c++ mode
Packit df99a1
}
Packit df99a1
#endif
Packit df99a1
#endif
Packit df99a1
Packit df99a1
/** @name Template.h
Packit df99a1
    
Packit df99a1
    Files #"Template.h"# and #"Template.cpp"# are not used for anything but
Packit df99a1
    the current programming and documentation standards in the DjVu reference
Packit df99a1
    library. This doc++ comment briefly describes the abstractions defined in
Packit df99a1
    this files.  It must mention all the files involved in implementing this
Packit df99a1
    features, as well as references to the main classes \Ref{classname}.  
Packit df99a1
Packit df99a1
    This comment may contain additional sections as follows:
Packit df99a1
Packit df99a1
    {\bf Algorithmic Remarks} --- Comments about the algorithms, their
Packit df99a1
    performance and their limitations.
Packit df99a1
Packit df99a1
    {\bf Historical Remarks} --- Comments about the successive revisions of
Packit df99a1
    this file and other anecdotical details. This is where we can amuse the
Packit df99a1
    reader with funny details.
Packit df99a1
Packit df99a1
    {\bf ToDo} --- Things that we have been thinking to do but did not
Packit df99a1
    fully implement yet. It should explain how we plan to modify the current
Packit df99a1
    code could be modified to implement these things. People who change this
Packit df99a1
    code thus should avoid jeopardizing these plans.
Packit df99a1
    
Packit df99a1
    {\bf Example} --- It would be cool to demonstrate how these functions
Packit df99a1
    can be used by providing a small segment of C/C++ code.
Packit df99a1
    \begin{verbatim}
Packit df99a1
       ExampleClass toto(3,4);
Packit df99a1
       toto.draw(mywin);
Packit df99a1
    \end{verbatim}
Packit df99a1
Packit df99a1
    This main doc++ comment is followed by a few doc++ entries.
Packit df99a1
    \begin{itemize}
Packit df99a1
    \item the "memo" field contains a single line description of the file.
Packit df99a1
    \item the "version" field contains a cvs magic expression.
Packit df99a1
    \item the author fields contains a list of authors and email addresses.
Packit df99a1
          (the #\\# termination breaks the line.)
Packit df99a1
    \end{itemize}
Packit df99a1
Packit df99a1
    @memo 
Packit df99a1
    Template header file
Packit df99a1
    @author: 
Packit df99a1
    L\'eon Bottou <leonb@research.att.com> -- initial implementation \\
Packit df99a1
    Andrew Erofeev <eaf@geocities.com> -- implemented EXTERNAL_TEMPLATES */
Packit df99a1
//@{
Packit df99a1
//T// The magic doc++ comment above opens a doc++ context.
Packit df99a1
Packit df99a1
Packit df99a1
Packit df99a1
//T// Now comes the 'interface part' of the file.
Packit df99a1
//T// The c++ classes and public functions are defined there.
Packit df99a1
//T// Doc++ comments must be inserted for all functions
Packit df99a1
//T// intended to be used by other people. 
Packit df99a1
//T//
Packit df99a1
//T// Quite often c++ sucks and it is necessary to have public or external symbols
Packit df99a1
//T// that actually are only there for implementation purposes. 
Packit df99a1
//T// It is good to give a comment but this should not be a doc++ comment
Packit df99a1
//T// (see class GPool in GContainer.h).  All other 'public' and 'protected' 
Packit df99a1
//T// members should have a doc++ comment. There is no need to comment 'private'
Packit df99a1
//T// members, although a regular comment can be useful (not a doc++ comment). 
Packit df99a1
Packit df99a1
Packit df99a1
Packit df99a1
/** One-line class description.
Packit df99a1
    Long description. There is no need to repeat the class name in the
Packit df99a1
    one-line description. The long description should describe the abstraction
Packit df99a1
    and point the user to the main member functions.  An example could be
Packit df99a1
    inserted when this is informative and not redundant with the file
Packit df99a1
    description.  Templates should document which member functions are
Packit df99a1
    required for their type argument. The availability of non availabilty of a
Packit df99a1
    copy constructor/copy operator can be specified when appropriate. 
Packit df99a1
    See the doc++ documentation for available LaTeX constructs. 
Packit df99a1
*/
Packit df99a1
Packit df99a1
class ExampleClass
Packit df99a1
{
Packit df99a1
public:
Packit df99a1
  /** Virtual Destructor. */
Packit df99a1
  ~ExampleClass();
Packit df99a1
  /** Null Constructor. */
Packit df99a1
  ExampleClass();
Packit df99a1
  /** Copy Constructor. */
Packit df99a1
  ExampleClass(ExampleClass &ref;;
Packit df99a1
  /** Copy operator. */
Packit df99a1
  ExampleClass& operator=(ExampleClass &ref;;
Packit df99a1
  /** Example of member function. The first sentence of the member
Packit df99a1
      function description must be a short single line description.
Packit df99a1
      The rest can be more verbose. Excerpts of C or C++ text should 
Packit df99a1
      be surrounded by dieze characters (as in #win#).  The doc++ #@param#
Packit df99a1
      construct should be used when there is a need for additional details
Packit df99a1
      about the arguments. In that case all the arguments must be documented
Packit df99a1
      with a #@param# directive.
Packit df99a1
      @param win drawing window.
Packit df99a1
      This window must be created with #CreateWindow# and must be visible when
Packit df99a1
      function #draw# is called.
Packit df99a1
   */
Packit df99a1
  void draw(Window win);
Packit df99a1
protected:
Packit df99a1
  /** Minimal x-coordinate. */
Packit df99a1
  int xmin;
Packit df99a1
  /** Maximal x-coordinate. */
Packit df99a1
  int xmax;
Packit df99a1
private:
Packit df99a1
  int whatever;
Packit df99a1
  float encode;
Packit df99a1
};
Packit df99a1
Packit df99a1
Packit df99a1
/** One-line function description.
Packit df99a1
    Long description. Public external functions should be documented
Packit df99a1
    as classes. Note that a family of public external function can be 
Packit df99a1
    introduced by a generic entry (see below) */
Packit df99a1
Packit df99a1
ExampleClass combine_example_classes(const ExampleClass&, 
Packit df99a1
                                     const ExampleClass &b);
Packit df99a1
Packit df99a1
Packit df99a1
/** @name Generic entry.
Packit df99a1
    Long description. there is sometimes a need to add documentation
Packit df99a1
    entries for grouping things which are not connected by the C++ 
Packit df99a1
    syntax (a family of functions, a family of defines, etc...).
Packit df99a1
    The description starts with a very short name (introduced with #@name#)
Packit df99a1
    followed by a long description.  Because of doc++ limitations,
Packit df99a1
    the one-line description must appear after the long description
Packit df99a1
    in a #@memo# entry.
Packit df99a1
    @memo One-line description
Packit df99a1
*/
Packit df99a1
Packit df99a1
//T// The following comments should be used when
Packit df99a1
//T// the preceding generic entry contains sub-entries
Packit df99a1
//@{
Packit df99a1
//T// Sub-entries (both DOC++ and C++) should be declared there.
Packit df99a1
//@}
Packit df99a1
Packit df99a1
Packit df99a1
Packit df99a1
Packit df99a1
Packit df99a1
Packit df99a1
//@}
Packit df99a1
//T// The magic doc++ comment above closes the doc++ file context.
Packit df99a1
//T// The rest of the file only contains implementation stuff.
Packit df99a1
Packit df99a1
// ------------ CLASSEXAMPLE INLINES
Packit df99a1
//T// This is where all the inline/template functions should be written
Packit df99a1
//T// This part of the file is segmented with comments.
Packit df99a1
Packit df99a1
inline void 
Packit df99a1
ClassExample::width()
Packit df99a1
{
Packit df99a1
  return xmax-xmin;
Packit df99a1
}
Packit df99a1
Packit df99a1
Packit df99a1
Packit df99a1
// ------------ THE END
Packit df99a1
//T// End name space
Packit df99a1
Packit df99a1
#ifdef HAVE_NAMESPACES
Packit df99a1
}
Packit df99a1
# ifndef NOT_USING_DJVU_NAMESPACE
Packit df99a1
using namespace DJVU;
Packit df99a1
# endif
Packit df99a1
#endif
Packit df99a1
#endif
Packit df99a1
//T// Terminates the multiple inclusion #ifndef
Packit df99a1
      
Packit df99a1
      
Packit df99a1
             
Packit df99a1
Packit df99a1