UriTemplate.h (1244B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef UriTemplateGlue_h__ 6 #define UriTemplateGlue_h__ 7 8 #include "mozilla/net/uritemplate_glue.h" 9 10 namespace mozilla::net { 11 12 class UriTemplateWrapper final { 13 public: 14 static void Init(const nsACString& aInput, UriTemplateWrapper** aBuilder) { 15 uri_template_new(&aInput, 16 (const mozilla::net::UriTemplateWrapper**)aBuilder); 17 } 18 19 nsresult Set(const nsACString& aName, const nsACString& aValue) { 20 return uri_template_set(this, &aName, &aValue); 21 } 22 23 nsresult Set(const nsACString& aName, int32_t aValue) { 24 return uri_template_set_int(this, &aName, aValue); 25 } 26 27 void Build(nsACString* aResult) { uri_template_build(this, aResult); } 28 29 void AddRef() { uri_template_addref(this); } 30 void Release() { uri_template_release(this); } 31 32 private: 33 UriTemplateWrapper() = delete; 34 ~UriTemplateWrapper() = delete; 35 UriTemplateWrapper(const UriTemplateWrapper&) = delete; 36 UriTemplateWrapper& operator=(const UriTemplateWrapper&) = delete; 37 }; 38 39 } // namespace mozilla::net 40 41 #endif // UriTemplateGlue_h__