2014-05-05 10:30:46 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-01-08 12:51:38 -08:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
|
2014-05-05 10:30:46 -07:00
|
|
|
/**
|
|
|
|
* nsTLiteralString_CharT
|
|
|
|
*
|
|
|
|
* Stores a null-terminated, immutable sequence of characters.
|
|
|
|
*
|
|
|
|
* Subclass of nsTString that restricts string value to a literal
|
|
|
|
* character sequence. This class does not own its data. The data is
|
|
|
|
* assumed to be permanent. In practice this is true because this code
|
|
|
|
* is only usable by and for libxul.
|
|
|
|
*/
|
2014-01-08 12:51:38 -08:00
|
|
|
class nsTLiteralString_CharT : public nsTString_CharT
|
2014-05-05 10:30:46 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-01-08 12:51:38 -08:00
|
|
|
|
2014-05-27 00:15:35 -07:00
|
|
|
typedef nsTLiteralString_CharT self_type;
|
2014-01-08 12:51:38 -08:00
|
|
|
|
2014-05-05 10:30:46 -07:00
|
|
|
public:
|
2014-01-08 12:51:38 -08:00
|
|
|
|
2014-05-05 10:30:46 -07:00
|
|
|
/**
|
|
|
|
* constructor
|
|
|
|
*/
|
2014-01-08 12:51:38 -08:00
|
|
|
|
2014-05-05 10:30:46 -07:00
|
|
|
template<size_type N>
|
2015-07-27 18:11:51 -07:00
|
|
|
explicit nsTLiteralString_CharT(const char_type (&aStr)[N])
|
2014-05-27 00:15:35 -07:00
|
|
|
: string_type(const_cast<char_type*>(aStr), N - 1, F_TERMINATED | F_LITERAL)
|
2014-05-05 10:30:46 -07:00
|
|
|
{
|
|
|
|
}
|
2014-01-08 12:51:38 -08:00
|
|
|
|
2014-05-05 10:30:46 -07:00
|
|
|
private:
|
2014-01-08 12:51:38 -08:00
|
|
|
|
2014-05-05 10:30:46 -07:00
|
|
|
// NOT TO BE IMPLEMENTED
|
|
|
|
template<size_type N>
|
2015-01-06 15:35:02 -08:00
|
|
|
nsTLiteralString_CharT(char_type (&aStr)[N]) = delete;
|
2014-05-05 10:30:46 -07:00
|
|
|
};
|