hqlres.hpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef _HQLRES_INCL
  14. #define _HQLRES_INCL
  15. #include "jarray.hpp"
  16. class ResourceManager
  17. {
  18. unsigned nextmfid;
  19. unsigned nextbsid;
  20. unsigned totalbytes;
  21. CIArray resources;
  22. Owned<IPropertyTree> manifest;
  23. bool finalized;
  24. public:
  25. ResourceManager();
  26. unsigned addString(unsigned len, const char *data);
  27. void addNamed(const char * type, unsigned len, const void *data, IPropertyTree *entry=NULL, unsigned id=(unsigned)-1, bool addToManifest=true, bool compressed=false);
  28. bool addCompress(const char * type, unsigned len, const void *data, IPropertyTree *entry=NULL, unsigned id=(unsigned)-1, bool addToManifest=true);
  29. void addManifest(const char *filename);
  30. void addManifestFromArchive(IPropertyTree *archive);
  31. void addWebServiceInfo(IPropertyTree *wsinfo);
  32. IPropertyTree *ensureManifestInfo(){if (!manifest) manifest.setown(createPTree("Manifest")); return manifest;}
  33. bool getDuplicateResourceId(const char *srctype, const char *respath, const char *filename, int &id);
  34. void finalize();
  35. unsigned count();
  36. bool flush(StringBuffer &filename, const char *basename, bool flushText, bool target64bit);
  37. void flushAsText(const char *filename);
  38. bool queryWriteText(StringBuffer & resTextName, const char * filename);
  39. private:
  40. void putbytes(int h, const void *b, unsigned len);
  41. void addManifestFile(const char *filename);
  42. void addManifestInclude(IPropertyTree &include, const char *dir);
  43. };
  44. #endif