/*
  Copyright (C) 2000-2005 SKYRIX Software AG

  This file is part of SOPE.

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

  SOPE 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 Lesser General Public
  License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with SOPE; see the file COPYING.  If not, write to the
  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  02111-1307, USA.
*/

#ifndef __NGObjWeb_WOResponse_private_H__
#define __NGObjWeb_WOResponse_private_H__

#include <NGObjWeb/WOResponse.h>

// fast inline functions (non-WO)

#define WOResponse_AddChar(__R__,__C__) \
  if (__R__) {__R__->addChar(__R__, @selector(appendContentCharacter:), __C__);}

#define WOResponse_AddString(__R__,__C__) \
  if (__R__) {__R__->addStr(__R__, @selector(appendContentString:), __C__);}
#define WOResponse_AddCString(__R__,__C__) \
  if (__R__) {__R__->addCStr(__R__, @selector(appendContentCString:), __C__);}

#define WOResponse_AddHtmlString(__R__,__C__) \
  if (__R__) {__R__->addHStr(__R__, @selector(appendContentHTMLString:), __C__);}

// TODO: performance ! - use static buffer and appendContentCString !

#define WOResponse_AddUInt(__R__,__C__) \
  if (__R__) {\
    switch(__C__) {\
      case 0: __R__->addCStr(__R__, @selector(appendContentCString:),"0");break;\
      case 1: __R__->addCStr(__R__, @selector(appendContentCString:),"1");break;\
      case 2: __R__->addCStr(__R__, @selector(appendContentCString:),"2");break;\
      case 3: __R__->addCStr(__R__, @selector(appendContentCString:),"3");break;\
      case 4: __R__->addCStr(__R__, @selector(appendContentCString:),"4");break;\
      default: {\
        char buf[12]; sprintf(buf,"%d", __C__); \
        __R__->addCStr(__R__, @selector(appendContentCString:), buf);}\
    }\
  }

#define WOResponse_AddInt(__R__,__C__) \
  if (__R__) {\
    switch(__C__) {\
      case 0: __R__->addCStr(__R__, @selector(appendContentCString:),"0");break;\
      case 1: __R__->addCStr(__R__, @selector(appendContentCString:),"1");break;\
      case 2: __R__->addCStr(__R__, @selector(appendContentCString:),"2");break;\
      case 3: __R__->addCStr(__R__, @selector(appendContentCString:),"3");break;\
      case 4: __R__->addCStr(__R__, @selector(appendContentCString:),"4");break;\
      default: {\
        char buf[12]; sprintf(buf,"%i", __C__); \
        __R__->addCStr(__R__, @selector(appendContentCString:), buf);}\
    }\
  }

#endif /* __NGObjWeb_WOResponse_private_H__ */
