// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: source.proto

#include "source.pb.h"

#include <algorithm>

#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// This is a temporary google only hack
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
#include "third_party/protobuf/version.h"
#endif
// @@protoc_insertion_point(includes)

namespace pb {
class SourceDefaultTypeInternal {
 public:
  ::google::protobuf::internal::ExplicitlyConstructed<Source>
      _instance;
} _Source_default_instance_;
}  // namespace pb
namespace protobuf_source_2eproto {
static void InitDefaultsSource() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::pb::_Source_default_instance_;
    new (ptr) ::pb::Source();
    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  }
  ::pb::Source::InitAsDefaultInstance();
}

::google::protobuf::internal::SCCInfo<0> scc_info_Source =
    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsSource}, {}};

void InitDefaults() {
  ::google::protobuf::internal::InitSCC(&scc_info_Source.base);
}

::google::protobuf::Metadata file_level_metadata[1];
const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[2];

const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::pb::Source, _has_bits_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::pb::Source, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::pb::Source, version_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::pb::Source, sourcetype_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::pb::Source, source_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::pb::Source, contenttype_),
  2,
  3,
  0,
  1,
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  { 0, 9, sizeof(::pb::Source)},
};

static ::google::protobuf::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::google::protobuf::Message*>(&::pb::_Source_default_instance_),
};

void protobuf_AssignDescriptors() {
  AddDescriptors();
  AssignDescriptors(
      "source.proto", schemas, file_default_instances, TableStruct::offsets,
      file_level_metadata, file_level_enum_descriptors, NULL);
}

void protobuf_AssignDescriptorsOnce() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
}

void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
}

void AddDescriptorsImpl() {
  InitDefaults();
  static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
      "\n\014source.proto\022\002pb\"\344\001\n\006Source\022#\n\007version"
      "\030\001 \002(\0162\022.pb.Source.Version\022*\n\nsourceType"
      "\030\002 \002(\0162\026.pb.Source.SourceTypes\022\016\n\006source"
      "\030\003 \002(\014\022\023\n\013contentType\030\004 \002(\t\"*\n\007Version\022\023"
      "\n\017UNKNOWN_VERSION\020\000\022\n\n\006_0_0_1\020\001\"8\n\013Sourc"
      "eTypes\022\027\n\023UNKNOWN_SOURCE_TYPE\020\000\022\020\n\014lbry_"
      "sd_hash\020\001"
  };
  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
      descriptor, 249);
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
    "source.proto", &protobuf_RegisterTypes);
}

void AddDescriptors() {
  static ::google::protobuf::internal::once_flag once;
  ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
  StaticDescriptorInitializer() {
    AddDescriptors();
  }
} static_descriptor_initializer;
}  // namespace protobuf_source_2eproto
namespace pb {
const ::google::protobuf::EnumDescriptor* Source_Version_descriptor() {
  protobuf_source_2eproto::protobuf_AssignDescriptorsOnce();
  return protobuf_source_2eproto::file_level_enum_descriptors[0];
}
bool Source_Version_IsValid(int value) {
  switch (value) {
    case 0:
    case 1:
      return true;
    default:
      return false;
  }
}

#if !defined(_MSC_VER) || _MSC_VER >= 1900
const Source_Version Source::UNKNOWN_VERSION;
const Source_Version Source::_0_0_1;
const Source_Version Source::Version_MIN;
const Source_Version Source::Version_MAX;
const int Source::Version_ARRAYSIZE;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
const ::google::protobuf::EnumDescriptor* Source_SourceTypes_descriptor() {
  protobuf_source_2eproto::protobuf_AssignDescriptorsOnce();
  return protobuf_source_2eproto::file_level_enum_descriptors[1];
}
bool Source_SourceTypes_IsValid(int value) {
  switch (value) {
    case 0:
    case 1:
      return true;
    default:
      return false;
  }
}

#if !defined(_MSC_VER) || _MSC_VER >= 1900
const Source_SourceTypes Source::UNKNOWN_SOURCE_TYPE;
const Source_SourceTypes Source::lbry_sd_hash;
const Source_SourceTypes Source::SourceTypes_MIN;
const Source_SourceTypes Source::SourceTypes_MAX;
const int Source::SourceTypes_ARRAYSIZE;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

// ===================================================================

void Source::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int Source::kVersionFieldNumber;
const int Source::kSourceTypeFieldNumber;
const int Source::kSourceFieldNumber;
const int Source::kContentTypeFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

Source::Source()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  ::google::protobuf::internal::InitSCC(
      &protobuf_source_2eproto::scc_info_Source.base);
  SharedCtor();
  // @@protoc_insertion_point(constructor:pb.Source)
}
Source::Source(const Source& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  source_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_source()) {
    source_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_);
  }
  contenttype_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.has_contenttype()) {
    contenttype_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.contenttype_);
  }
  ::memcpy(&version_, &from.version_,
    static_cast<size_t>(reinterpret_cast<char*>(&sourcetype_) -
    reinterpret_cast<char*>(&version_)) + sizeof(sourcetype_));
  // @@protoc_insertion_point(copy_constructor:pb.Source)
}

void Source::SharedCtor() {
  source_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  contenttype_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  ::memset(&version_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&sourcetype_) -
      reinterpret_cast<char*>(&version_)) + sizeof(sourcetype_));
}

Source::~Source() {
  // @@protoc_insertion_point(destructor:pb.Source)
  SharedDtor();
}

void Source::SharedDtor() {
  source_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  contenttype_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}

void Source::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const ::google::protobuf::Descriptor* Source::descriptor() {
  ::protobuf_source_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_source_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const Source& Source::default_instance() {
  ::google::protobuf::internal::InitSCC(&protobuf_source_2eproto::scc_info_Source.base);
  return *internal_default_instance();
}


void Source::Clear() {
// @@protoc_insertion_point(message_clear_start:pb.Source)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 3u) {
    if (cached_has_bits & 0x00000001u) {
      source_.ClearNonDefaultToEmptyNoArena();
    }
    if (cached_has_bits & 0x00000002u) {
      contenttype_.ClearNonDefaultToEmptyNoArena();
    }
  }
  if (cached_has_bits & 12u) {
    ::memset(&version_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&sourcetype_) -
        reinterpret_cast<char*>(&version_)) + sizeof(sourcetype_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear();
}

bool Source::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:pb.Source)
  for (;;) {
    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // required .pb.Source.Version version = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          if (::pb::Source_Version_IsValid(value)) {
            set_version(static_cast< ::pb::Source_Version >(value));
          } else {
            mutable_unknown_fields()->AddVarint(
                1, static_cast< ::google::protobuf::uint64>(value));
          }
        } else {
          goto handle_unusual;
        }
        break;
      }

      // required .pb.Source.SourceTypes sourceType = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          if (::pb::Source_SourceTypes_IsValid(value)) {
            set_sourcetype(static_cast< ::pb::Source_SourceTypes >(value));
          } else {
            mutable_unknown_fields()->AddVarint(
                2, static_cast< ::google::protobuf::uint64>(value));
          }
        } else {
          goto handle_unusual;
        }
        break;
      }

      // required bytes source = 3;
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
                input, this->mutable_source()));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // required string contentType = 4;
      case 4: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_contenttype()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->contenttype().data(), static_cast<int>(this->contenttype().length()),
            ::google::protobuf::internal::WireFormat::PARSE,
            "pb.Source.contentType");
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:pb.Source)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:pb.Source)
  return false;
#undef DO_
}

void Source::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:pb.Source)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // required .pb.Source.Version version = 1;
  if (cached_has_bits & 0x00000004u) {
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      1, this->version(), output);
  }

  // required .pb.Source.SourceTypes sourceType = 2;
  if (cached_has_bits & 0x00000008u) {
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      2, this->sourcetype(), output);
  }

  // required bytes source = 3;
  if (cached_has_bits & 0x00000001u) {
    ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
      3, this->source(), output);
  }

  // required string contentType = 4;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->contenttype().data(), static_cast<int>(this->contenttype().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "pb.Source.contentType");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      4, this->contenttype(), output);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        _internal_metadata_.unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:pb.Source)
}

::google::protobuf::uint8* Source::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:pb.Source)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // required .pb.Source.Version version = 1;
  if (cached_has_bits & 0x00000004u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
      1, this->version(), target);
  }

  // required .pb.Source.SourceTypes sourceType = 2;
  if (cached_has_bits & 0x00000008u) {
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
      2, this->sourcetype(), target);
  }

  // required bytes source = 3;
  if (cached_has_bits & 0x00000001u) {
    target =
      ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
        3, this->source(), target);
  }

  // required string contentType = 4;
  if (cached_has_bits & 0x00000002u) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->contenttype().data(), static_cast<int>(this->contenttype().length()),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "pb.Source.contentType");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        4, this->contenttype(), target);
  }

  if (_internal_metadata_.have_unknown_fields()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:pb.Source)
  return target;
}

size_t Source::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:pb.Source)
  size_t total_size = 0;

  if (has_source()) {
    // required bytes source = 3;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::BytesSize(
        this->source());
  }

  if (has_contenttype()) {
    // required string contentType = 4;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->contenttype());
  }

  if (has_version()) {
    // required .pb.Source.Version version = 1;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::EnumSize(this->version());
  }

  if (has_sourcetype()) {
    // required .pb.Source.SourceTypes sourceType = 2;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::EnumSize(this->sourcetype());
  }

  return total_size;
}
size_t Source::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:pb.Source)
  size_t total_size = 0;

  if (_internal_metadata_.have_unknown_fields()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        _internal_metadata_.unknown_fields());
  }
  if (((_has_bits_[0] & 0x0000000f) ^ 0x0000000f) == 0) {  // All required fields are present.
    // required bytes source = 3;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::BytesSize(
        this->source());

    // required string contentType = 4;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->contenttype());

    // required .pb.Source.Version version = 1;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::EnumSize(this->version());

    // required .pb.Source.SourceTypes sourceType = 2;
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::EnumSize(this->sourcetype());

  } else {
    total_size += RequiredFieldsByteSizeFallback();
  }
  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Source::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:pb.Source)
  GOOGLE_DCHECK_NE(&from, this);
  const Source* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const Source>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:pb.Source)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:pb.Source)
    MergeFrom(*source);
  }
}

void Source::MergeFrom(const Source& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:pb.Source)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 15u) {
    if (cached_has_bits & 0x00000001u) {
      set_has_source();
      source_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_);
    }
    if (cached_has_bits & 0x00000002u) {
      set_has_contenttype();
      contenttype_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.contenttype_);
    }
    if (cached_has_bits & 0x00000004u) {
      version_ = from.version_;
    }
    if (cached_has_bits & 0x00000008u) {
      sourcetype_ = from.sourcetype_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

void Source::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:pb.Source)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void Source::CopyFrom(const Source& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:pb.Source)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Source::IsInitialized() const {
  if ((_has_bits_[0] & 0x0000000f) != 0x0000000f) return false;
  return true;
}

void Source::Swap(Source* other) {
  if (other == this) return;
  InternalSwap(other);
}
void Source::InternalSwap(Source* other) {
  using std::swap;
  source_.Swap(&other->source_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  contenttype_.Swap(&other->contenttype_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(version_, other->version_);
  swap(sourcetype_, other->sourcetype_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  _internal_metadata_.Swap(&other->_internal_metadata_);
}

::google::protobuf::Metadata Source::GetMetadata() const {
  protobuf_source_2eproto::protobuf_AssignDescriptorsOnce();
  return ::protobuf_source_2eproto::file_level_metadata[kIndexInFileMessages];
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace pb
namespace google {
namespace protobuf {
template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::pb::Source* Arena::CreateMaybeMessage< ::pb::Source >(Arena* arena) {
  return Arena::CreateInternal< ::pb::Source >(arena);
}
}  // namespace protobuf
}  // namespace google

// @@protoc_insertion_point(global_scope)