Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Interface of CHTMLFile.
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //------------------------------------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #ifndef HTML_H
  14. #define HTML_H
  15. #ifdef WIN32
  16. #pragma once
  17. #endif
  18. #include <stdio.h>
  19. //------------------------------------------------------------------------------------------------------
  20. // Purpose: CHTMLFile represents an HTML text file that is being created. It has
  21. // some misc helper stuff, like writing the body tag for you, and linking to the style
  22. // sheet. Also some little helper functions to do <br>s and <p>s
  23. //------------------------------------------------------------------------------------------------------
  24. class CHTMLFile
  25. {
  26. public:
  27. static const bool printBody;
  28. static const bool dontPrintBody;
  29. static const bool linkStyle;
  30. static const bool dontLinkStyle;
  31. private:
  32. FILE* out;
  33. char filename[100];
  34. bool fBody;
  35. public:
  36. CHTMLFile():out(NULL),fBody(false){}
  37. CHTMLFile(const char*filenm ,const char* title,bool fPrintBody=true,const char* bgimage=NULL,int leftmarg=0,int topmarg=20);
  38. void open(const char*);
  39. void write(PRINTF_FORMAT_STRING const char*,...);
  40. void hr(int len=0,bool alignleft=false);
  41. void br(){write("<br>\n");}
  42. void p(){write("<p>\n");};
  43. void img(const char* i){write("<img src=%s>\n",i);}
  44. void div(const char* cls){write("<div class=%s>\n",cls);}
  45. void div(){write("<div>\n");}
  46. void enddiv(){write("</div>");}
  47. void close();
  48. ~CHTMLFile();
  49. };
  50. #endif // HTML_H