xpcom/string/public/nsTLiteralString.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/string/public/nsTLiteralString.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +
    1.11 +  /**
    1.12 +   * nsTLiteralString_CharT
    1.13 +   *
    1.14 +   * Stores a null-terminated, immutable sequence of characters.
    1.15 +   *
    1.16 +   * Subclass of nsTString that restricts string value to a literal
    1.17 +   * character sequence.  This class does not own its data. The data is
    1.18 +   * assumed to be permanent. In practice this is true because this code
    1.19 +   * is only usable by and for libxul.
    1.20 +   */
    1.21 +class nsTLiteralString_CharT : public nsTString_CharT
    1.22 +  {
    1.23 +    public:
    1.24 +
    1.25 +      typedef nsTLiteralString_CharT    self_type;
    1.26 +
    1.27 +    public:
    1.28 +
    1.29 +        /**
    1.30 +         * constructor
    1.31 +         */
    1.32 +
    1.33 +      template<size_type N>
    1.34 +      nsTLiteralString_CharT( const char_type (&str)[N] )
    1.35 +        : string_type(const_cast<char_type*>(str), N - 1, F_TERMINATED | F_LITERAL)
    1.36 +        {
    1.37 +        }
    1.38 +
    1.39 +    private:
    1.40 +
    1.41 +        // NOT TO BE IMPLEMENTED
    1.42 +      template<size_type N>
    1.43 +      nsTLiteralString_CharT( char_type (&str)[N] ) MOZ_DELETE;
    1.44 +  };

mercurial