This is an old revision of the document!


TWSG Code Conventions

O documento principal do TWSG Code Conventions pode ser encontrado no link (protegido). Este artigo no Wiki tende a ser um complemento deste manual de convenções de código.

Estrutura geral dos arquivos .h

Segundo o manual de convenções de código do TWSG, os arquivos de cabeçalho (.h) devem seguir esta estrutura:

Header_File
 |
 |--LICENSE_HEADER
 |
 |--FILE_IDENTIFICATION
 |
 |--HEADER_FILE_GUARD
 |
 |--INCLUDES_SECTION
 |
 |--NAMESPACE_DECLARATION
 |
 |--CLASSES_DECLARATION | FUNCTIONS_DECLARATION
 |
 |--END_HEADER_FILE

Estes componentes são discutidos brevemente nas subseções seguintes.

License header

A licença atualmente adotada no TerraOGC é a GNU GPL v3. Portanto todos os arquivos de cabeçalho, e os de implementação também (.cpp) devem iniciar pelas seguintes linhas:

/*
  Copyright (C) 2007-2009 TerraLib Web Services Group.

  This file is part of TerraOGC - a framework for Web-GIS development.

  TerraOGC is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License,
  or (at your option) any later version.

  TerraOGC Framework is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with TerraOGC. See COPYING. If not, write to
  TerraLib Web Services Group at <twsg@dpi.inpe.br>
  or see the online site: http://www.dpi.inpe.br/twsg.
*/

File identification

Em seguida, todos os arquivos devem ser identificados com informações sobre seu nome, breve descrição e autor(es), segundo o exemplo abaixo:

/** \file TeCGIUtils.h
 *  \brief This file contains commom routines for dealing with CGI applications.
 *  \author Gilberto Ribeiro de Queiroz
 *  \author Emerson M A Xavier
 */

Header file guard

Includes section

Classes declaration

Functions declaration

End header file

Level 3 Headline


Navigation