// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "mojo/public/cpp/bindings/lib/array_internal.h" #include #include #include namespace mojo { namespace internal { std::string MakeMessageWithArrayIndex(const char* message, size_t size, size_t index) { std::ostringstream stream; stream << message << ": array size - " << size << "; index - " << index; return stream.str(); } std::string MakeMessageWithExpectedArraySize(const char* message, size_t size, size_t expected_size) { std::ostringstream stream; stream << message << ": array size - " << size << "; expected size - " << expected_size; return stream.str(); } ArrayDataTraits::BitRef::~BitRef() { } ArrayDataTraits::BitRef::BitRef(uint8_t* storage, uint8_t mask) : storage_(storage), mask_(mask) { } ArrayDataTraits::BitRef& ArrayDataTraits::BitRef::operator=( bool value) { if (value) { *storage_ |= mask_; } else { *storage_ &= ~mask_; } return *this; } ArrayDataTraits::BitRef& ArrayDataTraits::BitRef::operator=( const BitRef& value) { return (*this) = static_cast(value); } ArrayDataTraits::BitRef::operator bool() const { return (*storage_ & mask_) != 0; } } // namespace internal } // namespace mojo