no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / xpcom / string / nsTPromiseFlatString.cpp
blob12433000337a9c88669043ca125d91f26e171181
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsTPromiseFlatString.h"
9 template <typename T>
10 void nsTPromiseFlatString<T>::Init(const substring_type& str) {
11 if (str.IsTerminated()) {
12 char_type* newData =
13 const_cast<char_type*>(static_cast<const char_type*>(str.Data()));
14 size_type newLength = str.Length();
15 DataFlags newDataFlags =
16 str.GetDataFlags() & (DataFlags::TERMINATED | DataFlags::LITERAL);
17 // does not promote DataFlags::VOIDED
19 this->SetData(newData, newLength, newDataFlags);
20 } else {
21 this->Assign(str);
25 template class nsTPromiseFlatString<char>;
26 template class nsTPromiseFlatString<char16_t>;