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

#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "Employees/Employee.pb.h"

#include <algorithm>

#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.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>
// @@protoc_insertion_point(includes)

namespace Diadoc {
namespace Api {
namespace Proto {
namespace Employees {

namespace {

const ::google::protobuf::Descriptor* Employee_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
  Employee_reflection_ = NULL;
const ::google::protobuf::Descriptor* EmployeePermissions_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
  EmployeePermissions_reflection_ = NULL;
const ::google::protobuf::Descriptor* EmployeeAction_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
  EmployeeAction_reflection_ = NULL;
const ::google::protobuf::Descriptor* EmployeeList_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
  EmployeeList_reflection_ = NULL;

}  // namespace

void protobuf_AssignDesc_Employees_2fEmployee_2eproto() {
  protobuf_AddDesc_Employees_2fEmployee_2eproto();
  const ::google::protobuf::FileDescriptor* file =
    ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
      "Employees/Employee.proto");
  GOOGLE_CHECK(file != NULL);
  Employee_descriptor_ = file->message_type(0);
  static const int Employee_offsets_[5] = {
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Employee, user_),
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Employee, permissions_),
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Employee, position_),
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Employee, canbeinvitedforchat_),
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Employee, creationtimestamp_),
  };
  Employee_reflection_ =
    new ::google::protobuf::internal::GeneratedMessageReflection(
      Employee_descriptor_,
      Employee::default_instance_,
      Employee_offsets_,
      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Employee, _has_bits_[0]),
      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Employee, _unknown_fields_),
      -1,
      ::google::protobuf::DescriptorPool::generated_pool(),
      ::google::protobuf::MessageFactory::generated_factory(),
      sizeof(Employee));
  EmployeePermissions_descriptor_ = file->message_type(1);
  static const int EmployeePermissions_offsets_[6] = {
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeePermissions, userdepartmentid_),
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeePermissions, isadministrator_),
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeePermissions, documentaccesslevel_),
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeePermissions, selecteddepartmentids_),
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeePermissions, actions_),
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeePermissions, authorizationpermission_),
  };
  EmployeePermissions_reflection_ =
    new ::google::protobuf::internal::GeneratedMessageReflection(
      EmployeePermissions_descriptor_,
      EmployeePermissions::default_instance_,
      EmployeePermissions_offsets_,
      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeePermissions, _has_bits_[0]),
      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeePermissions, _unknown_fields_),
      -1,
      ::google::protobuf::DescriptorPool::generated_pool(),
      ::google::protobuf::MessageFactory::generated_factory(),
      sizeof(EmployeePermissions));
  EmployeeAction_descriptor_ = file->message_type(2);
  static const int EmployeeAction_offsets_[2] = {
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeeAction, name_),
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeeAction, isallowed_),
  };
  EmployeeAction_reflection_ =
    new ::google::protobuf::internal::GeneratedMessageReflection(
      EmployeeAction_descriptor_,
      EmployeeAction::default_instance_,
      EmployeeAction_offsets_,
      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeeAction, _has_bits_[0]),
      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeeAction, _unknown_fields_),
      -1,
      ::google::protobuf::DescriptorPool::generated_pool(),
      ::google::protobuf::MessageFactory::generated_factory(),
      sizeof(EmployeeAction));
  EmployeeList_descriptor_ = file->message_type(3);
  static const int EmployeeList_offsets_[2] = {
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeeList, employees_),
    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeeList, totalcount_),
  };
  EmployeeList_reflection_ =
    new ::google::protobuf::internal::GeneratedMessageReflection(
      EmployeeList_descriptor_,
      EmployeeList::default_instance_,
      EmployeeList_offsets_,
      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeeList, _has_bits_[0]),
      GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EmployeeList, _unknown_fields_),
      -1,
      ::google::protobuf::DescriptorPool::generated_pool(),
      ::google::protobuf::MessageFactory::generated_factory(),
      sizeof(EmployeeList));
}

namespace {

GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
  ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
                 &protobuf_AssignDesc_Employees_2fEmployee_2eproto);
}

void protobuf_RegisterTypes(const ::std::string&) {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
    Employee_descriptor_, &Employee::default_instance());
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
    EmployeePermissions_descriptor_, &EmployeePermissions::default_instance());
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
    EmployeeAction_descriptor_, &EmployeeAction::default_instance());
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
    EmployeeList_descriptor_, &EmployeeList::default_instance());
}

}  // namespace

void protobuf_ShutdownFile_Employees_2fEmployee_2eproto() {
  delete Employee::default_instance_;
  delete Employee_reflection_;
  delete EmployeePermissions::default_instance_;
  delete EmployeePermissions_reflection_;
  delete EmployeeAction::default_instance_;
  delete EmployeeAction_reflection_;
  delete EmployeeList::default_instance_;
  delete EmployeeList_reflection_;
}

void protobuf_AddDesc_Employees_2fEmployee_2eproto() {
  static bool already_here = false;
  if (already_here) return;
  already_here = true;
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  ::Diadoc::Api::Proto::protobuf_AddDesc_User_2eproto();
  ::Diadoc::Api::Proto::protobuf_AddDesc_OrganizationUserPermissions_2eproto();
  ::Diadoc::Api::Proto::protobuf_AddDesc_Timestamp_2eproto();
  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
    "\n\030Employees/Employee.proto\022\032Diadoc.Api.P"
    "roto.Employees\032\nUser.proto\032!Organization"
    "UserPermissions.proto\032\017Timestamp.proto\"\337"
    "\001\n\010Employee\022&\n\004User\030\001 \002(\0132\030.Diadoc.Api.P"
    "roto.UserV2\022D\n\013Permissions\030\002 \002(\0132/.Diado"
    "c.Api.Proto.Employees.EmployeePermission"
    "s\022\020\n\010Position\030\003 \002(\t\022\033\n\023CanBeInvitedForCh"
    "at\030\004 \002(\010\0226\n\021CreationTimestamp\030\005 \001(\0132\033.Di"
    "adoc.Api.Proto.Timestamp\"\320\002\n\023EmployeePer"
    "missions\022\030\n\020UserDepartmentId\030\001 \002(\t\022\027\n\017Is"
    "Administrator\030\002 \002(\010\022^\n\023DocumentAccessLev"
    "el\030\003 \002(\0162%.Diadoc.Api.Proto.DocumentAcce"
    "ssLevel:\032UnknownDocumentAccessLevel\022\035\n\025S"
    "electedDepartmentIds\030\004 \003(\t\022;\n\007Actions\030\005 "
    "\003(\0132*.Diadoc.Api.Proto.Employees.Employe"
    "eAction\022J\n\027AuthorizationPermission\030\006 \001(\013"
    "2).Diadoc.Api.Proto.AuthorizationPermiss"
    "ion\"1\n\016EmployeeAction\022\014\n\004Name\030\001 \002(\t\022\021\n\tI"
    "sAllowed\030\002 \002(\010\"[\n\014EmployeeList\0227\n\tEmploy"
    "ees\030\001 \003(\0132$.Diadoc.Api.Proto.Employees.E"
    "mployee\022\022\n\nTotalCount\030\002 \002(\005", 827);
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
    "Employees/Employee.proto", &protobuf_RegisterTypes);
  Employee::default_instance_ = new Employee();
  EmployeePermissions::default_instance_ = new EmployeePermissions();
  EmployeeAction::default_instance_ = new EmployeeAction();
  EmployeeList::default_instance_ = new EmployeeList();
  Employee::default_instance_->InitAsDefaultInstance();
  EmployeePermissions::default_instance_->InitAsDefaultInstance();
  EmployeeAction::default_instance_->InitAsDefaultInstance();
  EmployeeList::default_instance_->InitAsDefaultInstance();
  ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_Employees_2fEmployee_2eproto);
}

// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_Employees_2fEmployee_2eproto {
  StaticDescriptorInitializer_Employees_2fEmployee_2eproto() {
    protobuf_AddDesc_Employees_2fEmployee_2eproto();
  }
} static_descriptor_initializer_Employees_2fEmployee_2eproto_;

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

#ifndef _MSC_VER
const int Employee::kUserFieldNumber;
const int Employee::kPermissionsFieldNumber;
const int Employee::kPositionFieldNumber;
const int Employee::kCanBeInvitedForChatFieldNumber;
const int Employee::kCreationTimestampFieldNumber;
#endif  // !_MSC_VER

Employee::Employee()
  : ::google::protobuf::Message() {
  SharedCtor();
  // @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Employees.Employee)
}

void Employee::InitAsDefaultInstance() {
  user_ = const_cast< ::Diadoc::Api::Proto::UserV2*>(&::Diadoc::Api::Proto::UserV2::default_instance());
  permissions_ = const_cast< ::Diadoc::Api::Proto::Employees::EmployeePermissions*>(&::Diadoc::Api::Proto::Employees::EmployeePermissions::default_instance());
  creationtimestamp_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
}

Employee::Employee(const Employee& from)
  : ::google::protobuf::Message() {
  SharedCtor();
  MergeFrom(from);
  // @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Employees.Employee)
}

void Employee::SharedCtor() {
  ::google::protobuf::internal::GetEmptyString();
  _cached_size_ = 0;
  user_ = NULL;
  permissions_ = NULL;
  position_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  canbeinvitedforchat_ = false;
  creationtimestamp_ = NULL;
  ::memset(_has_bits_, 0, sizeof(_has_bits_));
}

Employee::~Employee() {
  // @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Employees.Employee)
  SharedDtor();
}

void Employee::SharedDtor() {
  if (position_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
    delete position_;
  }
  if (this != default_instance_) {
    delete user_;
    delete permissions_;
    delete creationtimestamp_;
  }
}

void Employee::SetCachedSize(int size) const {
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Employee::descriptor() {
  protobuf_AssignDescriptorsOnce();
  return Employee_descriptor_;
}

const Employee& Employee::default_instance() {
  if (default_instance_ == NULL) protobuf_AddDesc_Employees_2fEmployee_2eproto();
  return *default_instance_;
}

Employee* Employee::default_instance_ = NULL;

Employee* Employee::New() const {
  return new Employee;
}

void Employee::Clear() {
  if (_has_bits_[0 / 32] & 31) {
    if (has_user()) {
      if (user_ != NULL) user_->::Diadoc::Api::Proto::UserV2::Clear();
    }
    if (has_permissions()) {
      if (permissions_ != NULL) permissions_->::Diadoc::Api::Proto::Employees::EmployeePermissions::Clear();
    }
    if (has_position()) {
      if (position_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
        position_->clear();
      }
    }
    canbeinvitedforchat_ = false;
    if (has_creationtimestamp()) {
      if (creationtimestamp_ != NULL) creationtimestamp_->::Diadoc::Api::Proto::Timestamp::Clear();
    }
  }
  ::memset(_has_bits_, 0, sizeof(_has_bits_));
  mutable_unknown_fields()->Clear();
}

bool Employee::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Employees.Employee)
  for (;;) {
    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // required .Diadoc.Api.Proto.UserV2 User = 1;
      case 1: {
        if (tag == 10) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
               input, mutable_user()));
        } else {
          goto handle_unusual;
        }
        if (input->ExpectTag(18)) goto parse_Permissions;
        break;
      }

      // required .Diadoc.Api.Proto.Employees.EmployeePermissions Permissions = 2;
      case 2: {
        if (tag == 18) {
         parse_Permissions:
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
               input, mutable_permissions()));
        } else {
          goto handle_unusual;
        }
        if (input->ExpectTag(26)) goto parse_Position;
        break;
      }

      // required string Position = 3;
      case 3: {
        if (tag == 26) {
         parse_Position:
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_position()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->position().data(), this->position().length(),
            ::google::protobuf::internal::WireFormat::PARSE,
            "position");
        } else {
          goto handle_unusual;
        }
        if (input->ExpectTag(32)) goto parse_CanBeInvitedForChat;
        break;
      }

      // required bool CanBeInvitedForChat = 4;
      case 4: {
        if (tag == 32) {
         parse_CanBeInvitedForChat:
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
                 input, &canbeinvitedforchat_)));
          set_has_canbeinvitedforchat();
        } else {
          goto handle_unusual;
        }
        if (input->ExpectTag(42)) goto parse_CreationTimestamp;
        break;
      }

      // optional .Diadoc.Api.Proto.Timestamp CreationTimestamp = 5;
      case 5: {
        if (tag == 42) {
         parse_CreationTimestamp:
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
               input, mutable_creationtimestamp()));
        } else {
          goto handle_unusual;
        }
        if (input->ExpectAtEnd()) goto success;
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0 ||
            ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Employees.Employee)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Employees.Employee)
  return false;
#undef DO_
}

void Employee::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Employees.Employee)
  // required .Diadoc.Api.Proto.UserV2 User = 1;
  if (has_user()) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      1, this->user(), output);
  }

  // required .Diadoc.Api.Proto.Employees.EmployeePermissions Permissions = 2;
  if (has_permissions()) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      2, this->permissions(), output);
  }

  // required string Position = 3;
  if (has_position()) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->position().data(), this->position().length(),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "position");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      3, this->position(), output);
  }

  // required bool CanBeInvitedForChat = 4;
  if (has_canbeinvitedforchat()) {
    ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->canbeinvitedforchat(), output);
  }

  // optional .Diadoc.Api.Proto.Timestamp CreationTimestamp = 5;
  if (has_creationtimestamp()) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      5, this->creationtimestamp(), output);
  }

  if (!unknown_fields().empty()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Employees.Employee)
}

::google::protobuf::uint8* Employee::SerializeWithCachedSizesToArray(
    ::google::protobuf::uint8* target) const {
  // @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Employees.Employee)
  // required .Diadoc.Api.Proto.UserV2 User = 1;
  if (has_user()) {
    target = ::google::protobuf::internal::WireFormatLite::
      WriteMessageNoVirtualToArray(
        1, this->user(), target);
  }

  // required .Diadoc.Api.Proto.Employees.EmployeePermissions Permissions = 2;
  if (has_permissions()) {
    target = ::google::protobuf::internal::WireFormatLite::
      WriteMessageNoVirtualToArray(
        2, this->permissions(), target);
  }

  // required string Position = 3;
  if (has_position()) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->position().data(), this->position().length(),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "position");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        3, this->position(), target);
  }

  // required bool CanBeInvitedForChat = 4;
  if (has_canbeinvitedforchat()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->canbeinvitedforchat(), target);
  }

  // optional .Diadoc.Api.Proto.Timestamp CreationTimestamp = 5;
  if (has_creationtimestamp()) {
    target = ::google::protobuf::internal::WireFormatLite::
      WriteMessageNoVirtualToArray(
        5, this->creationtimestamp(), target);
  }

  if (!unknown_fields().empty()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Employees.Employee)
  return target;
}

int Employee::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // required .Diadoc.Api.Proto.UserV2 User = 1;
    if (has_user()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
          this->user());
    }

    // required .Diadoc.Api.Proto.Employees.EmployeePermissions Permissions = 2;
    if (has_permissions()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
          this->permissions());
    }

    // required string Position = 3;
    if (has_position()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->position());
    }

    // required bool CanBeInvitedForChat = 4;
    if (has_canbeinvitedforchat()) {
      total_size += 1 + 1;
    }

    // optional .Diadoc.Api.Proto.Timestamp CreationTimestamp = 5;
    if (has_creationtimestamp()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
          this->creationtimestamp());
    }

  }
  if (!unknown_fields().empty()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        unknown_fields());
  }
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}

void Employee::MergeFrom(const ::google::protobuf::Message& from) {
  GOOGLE_CHECK_NE(&from, this);
  const Employee* source =
    ::google::protobuf::internal::dynamic_cast_if_available<const Employee*>(
      &from);
  if (source == NULL) {
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
    MergeFrom(*source);
  }
}

void Employee::MergeFrom(const Employee& from) {
  GOOGLE_CHECK_NE(&from, this);
  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    if (from.has_user()) {
      mutable_user()->::Diadoc::Api::Proto::UserV2::MergeFrom(from.user());
    }
    if (from.has_permissions()) {
      mutable_permissions()->::Diadoc::Api::Proto::Employees::EmployeePermissions::MergeFrom(from.permissions());
    }
    if (from.has_position()) {
      set_position(from.position());
    }
    if (from.has_canbeinvitedforchat()) {
      set_canbeinvitedforchat(from.canbeinvitedforchat());
    }
    if (from.has_creationtimestamp()) {
      mutable_creationtimestamp()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.creationtimestamp());
    }
  }
  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}

void Employee::CopyFrom(const ::google::protobuf::Message& from) {
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void Employee::CopyFrom(const Employee& from) {
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

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

  if (has_user()) {
    if (!this->user().IsInitialized()) return false;
  }
  if (has_permissions()) {
    if (!this->permissions().IsInitialized()) return false;
  }
  if (has_creationtimestamp()) {
    if (!this->creationtimestamp().IsInitialized()) return false;
  }
  return true;
}

void Employee::Swap(Employee* other) {
  if (other != this) {
    std::swap(user_, other->user_);
    std::swap(permissions_, other->permissions_);
    std::swap(position_, other->position_);
    std::swap(canbeinvitedforchat_, other->canbeinvitedforchat_);
    std::swap(creationtimestamp_, other->creationtimestamp_);
    std::swap(_has_bits_[0], other->_has_bits_[0]);
    _unknown_fields_.Swap(&other->_unknown_fields_);
    std::swap(_cached_size_, other->_cached_size_);
  }
}

::google::protobuf::Metadata Employee::GetMetadata() const {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::Metadata metadata;
  metadata.descriptor = Employee_descriptor_;
  metadata.reflection = Employee_reflection_;
  return metadata;
}

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

#ifndef _MSC_VER
const int EmployeePermissions::kUserDepartmentIdFieldNumber;
const int EmployeePermissions::kIsAdministratorFieldNumber;
const int EmployeePermissions::kDocumentAccessLevelFieldNumber;
const int EmployeePermissions::kSelectedDepartmentIdsFieldNumber;
const int EmployeePermissions::kActionsFieldNumber;
const int EmployeePermissions::kAuthorizationPermissionFieldNumber;
#endif  // !_MSC_VER

EmployeePermissions::EmployeePermissions()
  : ::google::protobuf::Message() {
  SharedCtor();
  // @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Employees.EmployeePermissions)
}

void EmployeePermissions::InitAsDefaultInstance() {
  authorizationpermission_ = const_cast< ::Diadoc::Api::Proto::AuthorizationPermission*>(&::Diadoc::Api::Proto::AuthorizationPermission::default_instance());
}

EmployeePermissions::EmployeePermissions(const EmployeePermissions& from)
  : ::google::protobuf::Message() {
  SharedCtor();
  MergeFrom(from);
  // @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Employees.EmployeePermissions)
}

void EmployeePermissions::SharedCtor() {
  ::google::protobuf::internal::GetEmptyString();
  _cached_size_ = 0;
  userdepartmentid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  isadministrator_ = false;
  documentaccesslevel_ = -1;
  authorizationpermission_ = NULL;
  ::memset(_has_bits_, 0, sizeof(_has_bits_));
}

EmployeePermissions::~EmployeePermissions() {
  // @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Employees.EmployeePermissions)
  SharedDtor();
}

void EmployeePermissions::SharedDtor() {
  if (userdepartmentid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
    delete userdepartmentid_;
  }
  if (this != default_instance_) {
    delete authorizationpermission_;
  }
}

void EmployeePermissions::SetCachedSize(int size) const {
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EmployeePermissions::descriptor() {
  protobuf_AssignDescriptorsOnce();
  return EmployeePermissions_descriptor_;
}

const EmployeePermissions& EmployeePermissions::default_instance() {
  if (default_instance_ == NULL) protobuf_AddDesc_Employees_2fEmployee_2eproto();
  return *default_instance_;
}

EmployeePermissions* EmployeePermissions::default_instance_ = NULL;

EmployeePermissions* EmployeePermissions::New() const {
  return new EmployeePermissions;
}

void EmployeePermissions::Clear() {
  if (_has_bits_[0 / 32] & 39) {
    if (has_userdepartmentid()) {
      if (userdepartmentid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
        userdepartmentid_->clear();
      }
    }
    isadministrator_ = false;
    documentaccesslevel_ = -1;
    if (has_authorizationpermission()) {
      if (authorizationpermission_ != NULL) authorizationpermission_->::Diadoc::Api::Proto::AuthorizationPermission::Clear();
    }
  }
  selecteddepartmentids_.Clear();
  actions_.Clear();
  ::memset(_has_bits_, 0, sizeof(_has_bits_));
  mutable_unknown_fields()->Clear();
}

bool EmployeePermissions::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Employees.EmployeePermissions)
  for (;;) {
    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // required string UserDepartmentId = 1;
      case 1: {
        if (tag == 10) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_userdepartmentid()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->userdepartmentid().data(), this->userdepartmentid().length(),
            ::google::protobuf::internal::WireFormat::PARSE,
            "userdepartmentid");
        } else {
          goto handle_unusual;
        }
        if (input->ExpectTag(16)) goto parse_IsAdministrator;
        break;
      }

      // required bool IsAdministrator = 2;
      case 2: {
        if (tag == 16) {
         parse_IsAdministrator:
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
                 input, &isadministrator_)));
          set_has_isadministrator();
        } else {
          goto handle_unusual;
        }
        if (input->ExpectTag(24)) goto parse_DocumentAccessLevel;
        break;
      }

      // required .Diadoc.Api.Proto.DocumentAccessLevel DocumentAccessLevel = 3 [default = UnknownDocumentAccessLevel];
      case 3: {
        if (tag == 24) {
         parse_DocumentAccessLevel:
          int value;
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
                 input, &value)));
          if (::Diadoc::Api::Proto::DocumentAccessLevel_IsValid(value)) {
            set_documentaccesslevel(static_cast< ::Diadoc::Api::Proto::DocumentAccessLevel >(value));
          } else {
            mutable_unknown_fields()->AddVarint(3, value);
          }
        } else {
          goto handle_unusual;
        }
        if (input->ExpectTag(34)) goto parse_SelectedDepartmentIds;
        break;
      }

      // repeated string SelectedDepartmentIds = 4;
      case 4: {
        if (tag == 34) {
         parse_SelectedDepartmentIds:
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->add_selecteddepartmentids()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->selecteddepartmentids(this->selecteddepartmentids_size() - 1).data(),
            this->selecteddepartmentids(this->selecteddepartmentids_size() - 1).length(),
            ::google::protobuf::internal::WireFormat::PARSE,
            "selecteddepartmentids");
        } else {
          goto handle_unusual;
        }
        if (input->ExpectTag(34)) goto parse_SelectedDepartmentIds;
        if (input->ExpectTag(42)) goto parse_Actions;
        break;
      }

      // repeated .Diadoc.Api.Proto.Employees.EmployeeAction Actions = 5;
      case 5: {
        if (tag == 42) {
         parse_Actions:
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
                input, add_actions()));
        } else {
          goto handle_unusual;
        }
        if (input->ExpectTag(42)) goto parse_Actions;
        if (input->ExpectTag(50)) goto parse_AuthorizationPermission;
        break;
      }

      // optional .Diadoc.Api.Proto.AuthorizationPermission AuthorizationPermission = 6;
      case 6: {
        if (tag == 50) {
         parse_AuthorizationPermission:
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
               input, mutable_authorizationpermission()));
        } else {
          goto handle_unusual;
        }
        if (input->ExpectAtEnd()) goto success;
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0 ||
            ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Employees.EmployeePermissions)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Employees.EmployeePermissions)
  return false;
#undef DO_
}

void EmployeePermissions::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Employees.EmployeePermissions)
  // required string UserDepartmentId = 1;
  if (has_userdepartmentid()) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->userdepartmentid().data(), this->userdepartmentid().length(),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "userdepartmentid");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      1, this->userdepartmentid(), output);
  }

  // required bool IsAdministrator = 2;
  if (has_isadministrator()) {
    ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->isadministrator(), output);
  }

  // required .Diadoc.Api.Proto.DocumentAccessLevel DocumentAccessLevel = 3 [default = UnknownDocumentAccessLevel];
  if (has_documentaccesslevel()) {
    ::google::protobuf::internal::WireFormatLite::WriteEnum(
      3, this->documentaccesslevel(), output);
  }

  // repeated string SelectedDepartmentIds = 4;
  for (int i = 0; i < this->selecteddepartmentids_size(); i++) {
  ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
    this->selecteddepartmentids(i).data(), this->selecteddepartmentids(i).length(),
    ::google::protobuf::internal::WireFormat::SERIALIZE,
    "selecteddepartmentids");
    ::google::protobuf::internal::WireFormatLite::WriteString(
      4, this->selecteddepartmentids(i), output);
  }

  // repeated .Diadoc.Api.Proto.Employees.EmployeeAction Actions = 5;
  for (int i = 0; i < this->actions_size(); i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      5, this->actions(i), output);
  }

  // optional .Diadoc.Api.Proto.AuthorizationPermission AuthorizationPermission = 6;
  if (has_authorizationpermission()) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      6, this->authorizationpermission(), output);
  }

  if (!unknown_fields().empty()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Employees.EmployeePermissions)
}

::google::protobuf::uint8* EmployeePermissions::SerializeWithCachedSizesToArray(
    ::google::protobuf::uint8* target) const {
  // @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Employees.EmployeePermissions)
  // required string UserDepartmentId = 1;
  if (has_userdepartmentid()) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->userdepartmentid().data(), this->userdepartmentid().length(),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "userdepartmentid");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        1, this->userdepartmentid(), target);
  }

  // required bool IsAdministrator = 2;
  if (has_isadministrator()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->isadministrator(), target);
  }

  // required .Diadoc.Api.Proto.DocumentAccessLevel DocumentAccessLevel = 3 [default = UnknownDocumentAccessLevel];
  if (has_documentaccesslevel()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
      3, this->documentaccesslevel(), target);
  }

  // repeated string SelectedDepartmentIds = 4;
  for (int i = 0; i < this->selecteddepartmentids_size(); i++) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->selecteddepartmentids(i).data(), this->selecteddepartmentids(i).length(),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "selecteddepartmentids");
    target = ::google::protobuf::internal::WireFormatLite::
      WriteStringToArray(4, this->selecteddepartmentids(i), target);
  }

  // repeated .Diadoc.Api.Proto.Employees.EmployeeAction Actions = 5;
  for (int i = 0; i < this->actions_size(); i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      WriteMessageNoVirtualToArray(
        5, this->actions(i), target);
  }

  // optional .Diadoc.Api.Proto.AuthorizationPermission AuthorizationPermission = 6;
  if (has_authorizationpermission()) {
    target = ::google::protobuf::internal::WireFormatLite::
      WriteMessageNoVirtualToArray(
        6, this->authorizationpermission(), target);
  }

  if (!unknown_fields().empty()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Employees.EmployeePermissions)
  return target;
}

int EmployeePermissions::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // required string UserDepartmentId = 1;
    if (has_userdepartmentid()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->userdepartmentid());
    }

    // required bool IsAdministrator = 2;
    if (has_isadministrator()) {
      total_size += 1 + 1;
    }

    // required .Diadoc.Api.Proto.DocumentAccessLevel DocumentAccessLevel = 3 [default = UnknownDocumentAccessLevel];
    if (has_documentaccesslevel()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::EnumSize(this->documentaccesslevel());
    }

    // optional .Diadoc.Api.Proto.AuthorizationPermission AuthorizationPermission = 6;
    if (has_authorizationpermission()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
          this->authorizationpermission());
    }

  }
  // repeated string SelectedDepartmentIds = 4;
  total_size += 1 * this->selecteddepartmentids_size();
  for (int i = 0; i < this->selecteddepartmentids_size(); i++) {
    total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
      this->selecteddepartmentids(i));
  }

  // repeated .Diadoc.Api.Proto.Employees.EmployeeAction Actions = 5;
  total_size += 1 * this->actions_size();
  for (int i = 0; i < this->actions_size(); i++) {
    total_size +=
      ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
        this->actions(i));
  }

  if (!unknown_fields().empty()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        unknown_fields());
  }
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}

void EmployeePermissions::MergeFrom(const ::google::protobuf::Message& from) {
  GOOGLE_CHECK_NE(&from, this);
  const EmployeePermissions* source =
    ::google::protobuf::internal::dynamic_cast_if_available<const EmployeePermissions*>(
      &from);
  if (source == NULL) {
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
    MergeFrom(*source);
  }
}

void EmployeePermissions::MergeFrom(const EmployeePermissions& from) {
  GOOGLE_CHECK_NE(&from, this);
  selecteddepartmentids_.MergeFrom(from.selecteddepartmentids_);
  actions_.MergeFrom(from.actions_);
  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    if (from.has_userdepartmentid()) {
      set_userdepartmentid(from.userdepartmentid());
    }
    if (from.has_isadministrator()) {
      set_isadministrator(from.isadministrator());
    }
    if (from.has_documentaccesslevel()) {
      set_documentaccesslevel(from.documentaccesslevel());
    }
    if (from.has_authorizationpermission()) {
      mutable_authorizationpermission()->::Diadoc::Api::Proto::AuthorizationPermission::MergeFrom(from.authorizationpermission());
    }
  }
  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}

void EmployeePermissions::CopyFrom(const ::google::protobuf::Message& from) {
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void EmployeePermissions::CopyFrom(const EmployeePermissions& from) {
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool EmployeePermissions::IsInitialized() const {
  if ((_has_bits_[0] & 0x00000007) != 0x00000007) return false;

  if (!::google::protobuf::internal::AllAreInitialized(this->actions())) return false;
  if (has_authorizationpermission()) {
    if (!this->authorizationpermission().IsInitialized()) return false;
  }
  return true;
}

void EmployeePermissions::Swap(EmployeePermissions* other) {
  if (other != this) {
    std::swap(userdepartmentid_, other->userdepartmentid_);
    std::swap(isadministrator_, other->isadministrator_);
    std::swap(documentaccesslevel_, other->documentaccesslevel_);
    selecteddepartmentids_.Swap(&other->selecteddepartmentids_);
    actions_.Swap(&other->actions_);
    std::swap(authorizationpermission_, other->authorizationpermission_);
    std::swap(_has_bits_[0], other->_has_bits_[0]);
    _unknown_fields_.Swap(&other->_unknown_fields_);
    std::swap(_cached_size_, other->_cached_size_);
  }
}

::google::protobuf::Metadata EmployeePermissions::GetMetadata() const {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::Metadata metadata;
  metadata.descriptor = EmployeePermissions_descriptor_;
  metadata.reflection = EmployeePermissions_reflection_;
  return metadata;
}

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

#ifndef _MSC_VER
const int EmployeeAction::kNameFieldNumber;
const int EmployeeAction::kIsAllowedFieldNumber;
#endif  // !_MSC_VER

EmployeeAction::EmployeeAction()
  : ::google::protobuf::Message() {
  SharedCtor();
  // @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Employees.EmployeeAction)
}

void EmployeeAction::InitAsDefaultInstance() {
}

EmployeeAction::EmployeeAction(const EmployeeAction& from)
  : ::google::protobuf::Message() {
  SharedCtor();
  MergeFrom(from);
  // @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Employees.EmployeeAction)
}

void EmployeeAction::SharedCtor() {
  ::google::protobuf::internal::GetEmptyString();
  _cached_size_ = 0;
  name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  isallowed_ = false;
  ::memset(_has_bits_, 0, sizeof(_has_bits_));
}

EmployeeAction::~EmployeeAction() {
  // @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Employees.EmployeeAction)
  SharedDtor();
}

void EmployeeAction::SharedDtor() {
  if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
    delete name_;
  }
  if (this != default_instance_) {
  }
}

void EmployeeAction::SetCachedSize(int size) const {
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EmployeeAction::descriptor() {
  protobuf_AssignDescriptorsOnce();
  return EmployeeAction_descriptor_;
}

const EmployeeAction& EmployeeAction::default_instance() {
  if (default_instance_ == NULL) protobuf_AddDesc_Employees_2fEmployee_2eproto();
  return *default_instance_;
}

EmployeeAction* EmployeeAction::default_instance_ = NULL;

EmployeeAction* EmployeeAction::New() const {
  return new EmployeeAction;
}

void EmployeeAction::Clear() {
  if (_has_bits_[0 / 32] & 3) {
    if (has_name()) {
      if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
        name_->clear();
      }
    }
    isallowed_ = false;
  }
  ::memset(_has_bits_, 0, sizeof(_has_bits_));
  mutable_unknown_fields()->Clear();
}

bool EmployeeAction::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Employees.EmployeeAction)
  for (;;) {
    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // required string Name = 1;
      case 1: {
        if (tag == 10) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_name()));
          ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
            this->name().data(), this->name().length(),
            ::google::protobuf::internal::WireFormat::PARSE,
            "name");
        } else {
          goto handle_unusual;
        }
        if (input->ExpectTag(16)) goto parse_IsAllowed;
        break;
      }

      // required bool IsAllowed = 2;
      case 2: {
        if (tag == 16) {
         parse_IsAllowed:
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
                 input, &isallowed_)));
          set_has_isallowed();
        } else {
          goto handle_unusual;
        }
        if (input->ExpectAtEnd()) goto success;
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0 ||
            ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Employees.EmployeeAction)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Employees.EmployeeAction)
  return false;
#undef DO_
}

void EmployeeAction::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Employees.EmployeeAction)
  // required string Name = 1;
  if (has_name()) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->name().data(), this->name().length(),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "name");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      1, this->name(), output);
  }

  // required bool IsAllowed = 2;
  if (has_isallowed()) {
    ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->isallowed(), output);
  }

  if (!unknown_fields().empty()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Employees.EmployeeAction)
}

::google::protobuf::uint8* EmployeeAction::SerializeWithCachedSizesToArray(
    ::google::protobuf::uint8* target) const {
  // @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Employees.EmployeeAction)
  // required string Name = 1;
  if (has_name()) {
    ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
      this->name().data(), this->name().length(),
      ::google::protobuf::internal::WireFormat::SERIALIZE,
      "name");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        1, this->name(), target);
  }

  // required bool IsAllowed = 2;
  if (has_isallowed()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->isallowed(), target);
  }

  if (!unknown_fields().empty()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Employees.EmployeeAction)
  return target;
}

int EmployeeAction::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // required string Name = 1;
    if (has_name()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::StringSize(
          this->name());
    }

    // required bool IsAllowed = 2;
    if (has_isallowed()) {
      total_size += 1 + 1;
    }

  }
  if (!unknown_fields().empty()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        unknown_fields());
  }
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}

void EmployeeAction::MergeFrom(const ::google::protobuf::Message& from) {
  GOOGLE_CHECK_NE(&from, this);
  const EmployeeAction* source =
    ::google::protobuf::internal::dynamic_cast_if_available<const EmployeeAction*>(
      &from);
  if (source == NULL) {
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
    MergeFrom(*source);
  }
}

void EmployeeAction::MergeFrom(const EmployeeAction& from) {
  GOOGLE_CHECK_NE(&from, this);
  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    if (from.has_name()) {
      set_name(from.name());
    }
    if (from.has_isallowed()) {
      set_isallowed(from.isallowed());
    }
  }
  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}

void EmployeeAction::CopyFrom(const ::google::protobuf::Message& from) {
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void EmployeeAction::CopyFrom(const EmployeeAction& from) {
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool EmployeeAction::IsInitialized() const {
  if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;

  return true;
}

void EmployeeAction::Swap(EmployeeAction* other) {
  if (other != this) {
    std::swap(name_, other->name_);
    std::swap(isallowed_, other->isallowed_);
    std::swap(_has_bits_[0], other->_has_bits_[0]);
    _unknown_fields_.Swap(&other->_unknown_fields_);
    std::swap(_cached_size_, other->_cached_size_);
  }
}

::google::protobuf::Metadata EmployeeAction::GetMetadata() const {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::Metadata metadata;
  metadata.descriptor = EmployeeAction_descriptor_;
  metadata.reflection = EmployeeAction_reflection_;
  return metadata;
}

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

#ifndef _MSC_VER
const int EmployeeList::kEmployeesFieldNumber;
const int EmployeeList::kTotalCountFieldNumber;
#endif  // !_MSC_VER

EmployeeList::EmployeeList()
  : ::google::protobuf::Message() {
  SharedCtor();
  // @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Employees.EmployeeList)
}

void EmployeeList::InitAsDefaultInstance() {
}

EmployeeList::EmployeeList(const EmployeeList& from)
  : ::google::protobuf::Message() {
  SharedCtor();
  MergeFrom(from);
  // @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Employees.EmployeeList)
}

void EmployeeList::SharedCtor() {
  _cached_size_ = 0;
  totalcount_ = 0;
  ::memset(_has_bits_, 0, sizeof(_has_bits_));
}

EmployeeList::~EmployeeList() {
  // @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Employees.EmployeeList)
  SharedDtor();
}

void EmployeeList::SharedDtor() {
  if (this != default_instance_) {
  }
}

void EmployeeList::SetCachedSize(int size) const {
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* EmployeeList::descriptor() {
  protobuf_AssignDescriptorsOnce();
  return EmployeeList_descriptor_;
}

const EmployeeList& EmployeeList::default_instance() {
  if (default_instance_ == NULL) protobuf_AddDesc_Employees_2fEmployee_2eproto();
  return *default_instance_;
}

EmployeeList* EmployeeList::default_instance_ = NULL;

EmployeeList* EmployeeList::New() const {
  return new EmployeeList;
}

void EmployeeList::Clear() {
  totalcount_ = 0;
  employees_.Clear();
  ::memset(_has_bits_, 0, sizeof(_has_bits_));
  mutable_unknown_fields()->Clear();
}

bool EmployeeList::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Employees.EmployeeList)
  for (;;) {
    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // repeated .Diadoc.Api.Proto.Employees.Employee Employees = 1;
      case 1: {
        if (tag == 10) {
         parse_Employees:
          DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
                input, add_employees()));
        } else {
          goto handle_unusual;
        }
        if (input->ExpectTag(10)) goto parse_Employees;
        if (input->ExpectTag(16)) goto parse_TotalCount;
        break;
      }

      // required int32 TotalCount = 2;
      case 2: {
        if (tag == 16) {
         parse_TotalCount:
          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
                 input, &totalcount_)));
          set_has_totalcount();
        } else {
          goto handle_unusual;
        }
        if (input->ExpectAtEnd()) goto success;
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0 ||
            ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
            ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Employees.EmployeeList)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Employees.EmployeeList)
  return false;
#undef DO_
}

void EmployeeList::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Employees.EmployeeList)
  // repeated .Diadoc.Api.Proto.Employees.Employee Employees = 1;
  for (int i = 0; i < this->employees_size(); i++) {
    ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
      1, this->employees(i), output);
  }

  // required int32 TotalCount = 2;
  if (has_totalcount()) {
    ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->totalcount(), output);
  }

  if (!unknown_fields().empty()) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        unknown_fields(), output);
  }
  // @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Employees.EmployeeList)
}

::google::protobuf::uint8* EmployeeList::SerializeWithCachedSizesToArray(
    ::google::protobuf::uint8* target) const {
  // @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Employees.EmployeeList)
  // repeated .Diadoc.Api.Proto.Employees.Employee Employees = 1;
  for (int i = 0; i < this->employees_size(); i++) {
    target = ::google::protobuf::internal::WireFormatLite::
      WriteMessageNoVirtualToArray(
        1, this->employees(i), target);
  }

  // required int32 TotalCount = 2;
  if (has_totalcount()) {
    target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->totalcount(), target);
  }

  if (!unknown_fields().empty()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Employees.EmployeeList)
  return target;
}

int EmployeeList::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) {
    // required int32 TotalCount = 2;
    if (has_totalcount()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::Int32Size(
          this->totalcount());
    }

  }
  // repeated .Diadoc.Api.Proto.Employees.Employee Employees = 1;
  total_size += 1 * this->employees_size();
  for (int i = 0; i < this->employees_size(); i++) {
    total_size +=
      ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
        this->employees(i));
  }

  if (!unknown_fields().empty()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        unknown_fields());
  }
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}

void EmployeeList::MergeFrom(const ::google::protobuf::Message& from) {
  GOOGLE_CHECK_NE(&from, this);
  const EmployeeList* source =
    ::google::protobuf::internal::dynamic_cast_if_available<const EmployeeList*>(
      &from);
  if (source == NULL) {
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
    MergeFrom(*source);
  }
}

void EmployeeList::MergeFrom(const EmployeeList& from) {
  GOOGLE_CHECK_NE(&from, this);
  employees_.MergeFrom(from.employees_);
  if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) {
    if (from.has_totalcount()) {
      set_totalcount(from.totalcount());
    }
  }
  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}

void EmployeeList::CopyFrom(const ::google::protobuf::Message& from) {
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void EmployeeList::CopyFrom(const EmployeeList& from) {
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool EmployeeList::IsInitialized() const {
  if ((_has_bits_[0] & 0x00000002) != 0x00000002) return false;

  if (!::google::protobuf::internal::AllAreInitialized(this->employees())) return false;
  return true;
}

void EmployeeList::Swap(EmployeeList* other) {
  if (other != this) {
    employees_.Swap(&other->employees_);
    std::swap(totalcount_, other->totalcount_);
    std::swap(_has_bits_[0], other->_has_bits_[0]);
    _unknown_fields_.Swap(&other->_unknown_fields_);
    std::swap(_cached_size_, other->_cached_size_);
  }
}

::google::protobuf::Metadata EmployeeList::GetMetadata() const {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::Metadata metadata;
  metadata.descriptor = EmployeeList_descriptor_;
  metadata.reflection = EmployeeList_reflection_;
  return metadata;
}

// @@protoc_insertion_point(namespace_scope)

}  // namespace Employees
}  // namespace Proto
}  // namespace Api
}  // namespace Diadoc

// @@protoc_insertion_point(global_scope)

repository: diadoc/diadocsdk-cpp

repo_name: diadoc/diadocsdk-cpp

extension: cc


text:
package commands

import "testing"

func TestWhitelistFilenames(t *testing.T) {
	goodFiles := []string{"123.png", "aFwofEhFJ.jpeg"}
	badFiles := []string{"elf", "something.exe"}
	for _, filename := range goodFiles {
		if !isAllowed(filename) {
			t.Errorf("%s should be a whitelisted filename", filename)
		}
	}
	for _, filename := range badFiles {
		if isAllowed(filename) {
			t.Errorf("%s should not be a whitelisted filename", filename)
		}
	}
}

license: MIT

repository: Kirbydoodoo/ZeroTsu

license_type: permissive

repo_name: Kirbydoodoo/ZeroTsu

branch_name: refs/heads/master

extension: go


text:
package stats

import (
	"time"
)

type ServerStats struct {
	Total     int       `json:"total"`
	ExecTimes []float64 `json:"-"`
	Average   float64   `json:"average"`
}

// New returns a new instance of ServerStats
func New() *ServerStats {
	sStats := ServerStats{}
	return &sStats
}

// SuccessfulRequest increments total and calculate the new average based on startTime and endTime
func (sStats *ServerStats) SuccessfulRequest(startTime time.Time, endTime time.Time) {
	var sum float64
	diff := endTime.Sub(startTime)
	diffMicro := diff.Seconds() * 1000000
	sStats.ExecTimes = append(sStats.ExecTimes, diffMicro)
	for _, num := range sStats.ExecTimes {
		sum += num
	}
	average := sum / float64(len(sStats.ExecTimes))
	sStats.Average = average
	sStats.Total++
}

gha_license_id: MIT

gha_language: Go


text:
//
//  utils.hpp
//  picodb
//
//  Created by Trevor Bakker on 9/22/17.
//  Copyright © 2017 Trevor Bakker. All rights reserved.
//

#ifndef utils_h
#define utils_h

#include <vector>
#include <sstream>

std::vector<std::string> split( const std::string &s, char delimiter )
{
  std::vector< std::string> out{};
  std::stringstream ss {s};
  std::string token;

  while( std::getline( ss, token, delimiter ) )
  {
    out.push_back( token );
  }

  return out;
}

bool isPrefix( const std::string & s, const std::string& of )
{
  if( s.size() > of.size() )
  {
    return false;
  }
  return std::equal( s.begin(), s.end(), of.begin() );
}
#endif /* utils_h */

extension: hpp


text:
package lib

import (
	"encoding/json"
	"fmt"
	"net/http"

	"github.com/newworld-lab/go-bitbankcc/entity"
	"github.com/pkg/errors"
)

const (
	formatTicker = "/%s/ticker"
)

type tickerResponse struct {
	baseResponse
	Data struct {
		baseData
		entity.Ticker
	} `json:"data"`
}

func (api *APIImpl) GetTicker(pair entity.TypePair) (*entity.Ticker, error) {
	if api == nil {
		return nil, errors.New("api is nil")
	}

	bytes, err := api.client.request(&clientOption{
		endpoint: publicApiEndpoint,
		method:   http.MethodGet,
		path:     fmt.Sprintf(formatTicker, pair),
	})
	if err != nil {
		return nil, err
	}

	res := new(tickerResponse)
	err = json.Unmarshal(bytes, res)
	if err != nil {
		return nil, errors.WithStack(err)
	}

	if res.Success != 1 {
		return nil, errors.Errorf("api error code=%d", res.Data.Code)
	}

	return &res.Data.Ticker, nil
}

repository: newworld-lab/go-bitbankcc

repo_name: newworld-lab/go-bitbankcc


text:
package resources

import (
	"testing"

	"github.com/riser-platform/riser-server/api/v1/model"
	"github.com/riser-platform/riser-server/pkg/core"
	"github.com/stretchr/testify/assert"
)

func Test_createHealthcheckDenyPolicy(t *testing.T) {
	ctx := &core.DeploymentContext{
		DeploymentConfig: &core.DeploymentConfig{
			Name:            "myapp-dep",
			EnvironmentName: "myenv",
			App: &model.AppConfig{
				Name: "myapp",
				HealthCheck: &model.AppConfigHealthCheck{
					Path: "/health",
				},
			},
		},
	}

	result := CreateHealthcheckDenyPolicy(ctx)

	assert.Equal(t, "myapp-dep-healthcheck-deny", result.Name)
	assert.Equal(t, deploymentLabels(ctx), result.Labels)
	assert.Equal(t, deploymentAnnotations(ctx), result.Annotations)
	assert.Equal(t, "AuthorizationPolicy", result.TypeMeta.Kind)
	assert.Equal(t, "security.istio.io/v1beta1", result.TypeMeta.APIVersion)
	assert.Equal(t, "myapp-dep", result.Spec.Selector.MatchLabels["riser.dev/deployment"])
	assert.Equal(t, "DENY", result.Spec.Action.String())
	assert.Equal(t, "/health", result.Spec.Rules[0].To[0].Operation.Paths[0])
}

func Test_createHealthcheckDenyPolicy_NoHealthcheckReturnsNil(t *testing.T) {
	ctx := &core.DeploymentContext{
		DeploymentConfig: &core.DeploymentConfig{
			Name:            "myapp-dep",
			EnvironmentName: "myenv",
			App: &model.AppConfig{
				Name: "myapp",
			},
		},
	}

	result := CreateHealthcheckDenyPolicy(ctx)

	assert.Nil(t, result)
}

repository: riser-platform/riser-server

repo_name: riser-platform/riser-server

branch_name: refs/heads/main


text:
SUMMARY = "Simple DNS resolver for asyncio"
DESCRIPTION = "aiodns provides a simple way for doing asynchronous DNS resolutions using pycares."
HOMEPAGE = "https://github.com/saghul/aiodns"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=a565d8b5d06b9620968a135a2657b093"

SRC_URI[md5sum] = "181e11935c78965de2b2b7b0e5efba8d"
SRC_URI[sha256sum] = "946bdfabe743fceeeb093c8a010f5d1645f708a241be849e17edfb0e49e08cd6"

PYPI_PACKAGE = "aiodns"

inherit pypi setuptools3

RDEPENDS:${PN} += " \
    ${PYTHON_PN}-asyncio \
    ${PYTHON_PN}-pycares \
"

repository: openembedded/meta-openembedded

repo_name: openembedded/meta-openembedded

gha_language: BitBake

extension: bb


text:
DESCRIPTION = "A Pure Python SNMP Package"
SECTION = "devel/python"
PRIORITY = "optional"
RDEPENDS_${PN} = "python-core"
LICENSE = "LGPL"

SRCNAME = "pysnmp-se"
SRC_URI = "http://downloads.sourceforge.net/twistedsnmp/${SRCNAME}-${PV}.tar.gz"

S = "${WORKDIR}/${SRCNAME}-${PV}"

inherit distutils

gha_language: C


text:
// Package main implements an extremely cut-down version of jarcat
// which is used to break a circular dependency; jarcat depends on
// several third-party libraries, and we use the jarcat tool to extract them.
//
// This implements minimal unzip logic that is command-line compatible with that
// subcommand.
package main

import (
	"archive/zip"
	"fmt"
	"io"
	"os"
	"path"
)

func main() {
	if len(os.Args) != 3 || os.Args[1] != "x" {
		fmt.Fprintf(os.Stderr, "Usage: jarcat_unzip x <zipfile>\n")
		os.Exit(1)
	}
	if err := extract(os.Args[2]); err != nil {
		fmt.Fprintf(os.Stderr, "Failed to extract: %s\n", err)
		os.Exit(1)
	}
}

func extract(zipfile string) error {
	zf, err := zip.OpenReader(zipfile)
	if err != nil {
		return err
	}
	defer zf.Close()
	for _, f := range zf.File {
		if f.Mode()&os.ModeDir == 0 {
			if err := extractFile(f); err != nil {
				return err
			}
		}
	}
	return nil
}

func extractFile(f *zip.File) error {
	r, err := f.Open()
	if err != nil {
		return err
	}
	defer r.Close()
	if err := os.MkdirAll(path.Dir(f.Name), os.ModeDir|0755); err != nil {
		return err
	}
	o, err := os.OpenFile(f.Name, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())
	if err != nil {
		return err
	}
	defer o.Close()
	_, err = io.Copy(o, r)
	return err
}

repository: markchalloner/please

repo_name: markchalloner/please


text:
package v1alpha1

const (
	ForbiddenNodeLabelsAnnotation            = "capsule.clastix.io/forbidden-node-labels"
	ForbiddenNodeLabelsRegexpAnnotation      = "capsule.clastix.io/forbidden-node-labels-regexp"
	ForbiddenNodeAnnotationsAnnotation       = "capsule.clastix.io/forbidden-node-annotations"
	ForbiddenNodeAnnotationsRegexpAnnotation = "capsule.clastix.io/forbidden-node-annotations-regexp"
)


text:
package node

import "golang.org/x/net/html"

// AllFn gets a slice of filters and returns new filter func. This function
// calls each filter from the slice with given *html.Node and returns okRes if
// all filters return true otherwise this function returns !okRes.
func AllFn(okRes bool, filters ...func(*html.Node) bool) func(*html.Node) bool {
	return func(n *html.Node) bool {
		for _, filter := range filters {
			if !filter(n) {
				return !okRes
			}
		}
		return okRes
	}
}

// AnyFn gets a slice of filters and returns new func. This function calls each
// filter from the slice with given *html.Node and returns okRes if any call of
// filter returns true. If all filters returns false this function returns
// !okRes.
func AnyFn(okRes bool, filters ...func(*html.Node) bool) func(*html.Node) bool {
	return func(n *html.Node) bool {
		for _, filter := range filters {
			if filter(n) {
				return okRes
			}
		}
		return !okRes
	}
}

repository: krasoffski/gomill

repo_name: krasoffski/gomill


text:
@article{LiScalableSecureSharing2013,
 abstract = {Personal health record (PHR) is an emerging patient-centric model of health information exchange, which is often outsourced to be stored at a third party, such as cloud providers. However, there have been wide privacy concerns as personal health information could be exposed to those third party servers and to unauthorized parties. To assure the patients' control over access to their own PHRs, it is a promising method to encrypt the PHRs before outsourcing. Yet, issues such as risks of privacy exposure, scalability in key management, flexible access, and efficient user revocation, have remained the most important challenges toward achieving fine-grained, cryptographically enforced data access control. In this paper, we propose a novel patient-centric framework and a suite of mechanisms for data access control to PHRs stored in semitrusted servers. To achieve fine-grained and scalable data access control for PHRs, we leverage attribute-based encryption (ABE) techniques to encrypt each patient's PHR file. Different from previous works in secure data outsourcing, we focus on the multiple data owner scenario, and divide the users in the PHR system into multiple security domains that greatly reduces the key management complexity for owners and users. A high degree of patient privacy is guaranteed simultaneously by exploiting multiauthority ABE. Our scheme also enables dynamic modification of access policies or file attributes, supports efficient on-demand user/attribute revocation and break-glass access under emergency scenarios. Extensive analytical and experimental results are presented which show the security, scalability, and efficiency of our proposed scheme.},
 author = {Li, Ming and Yu, Shucheng and Zheng, Yao and Ren, Kui and Lou, Wenjing},
 doi = {10.1109/TPDS.2012.97},
 journal = {IEEE Transactions on Parallel and Distributed Systems},
 month = {January},
 number = {1},
 pages = {131--143},
 title = {Scalable and Secure Sharing of Personal Health Records in Cloud Computing Using Attribute-Based Encryption},
 volume = {24},
 year = {2013}
}

extension: bib


text:
/** @file Extremum.h
 *
 * @author	Marek Kopicki (The University Of Birmingham)
 *
 * @version 1.0
 *
 */

#pragma once
#ifndef _GOLEM_MATH_EXTREMUM_H_
#define _GOLEM_MATH_EXTREMUM_H_

//------------------------------------------------------------------------------

#include <Golem/Math/Function.h>
#include <vector>

namespace golem {

//------------------------------------------------------------------------------

/** Finds function extrema. */
template <typename REAL>
class Extremum {
public:
	typedef shared_ptr< Extremum<REAL> > Ptr;

	static const U32 PARTITIONS_DFLT = 100;
	static const REAL GAIN_DFLT;
	static const REAL EPS_DFLT;

	virtual ~Extremum() {}

	/** Finds function local extremum starting with the interval [a, b] */
	virtual bool findLocal(REAL &x, REAL &y, const Function<REAL> &function, REAL a, REAL b, bool min = true) const = 0;

	/** Finds function global extremum within specified interval [left, right] */
	virtual bool findGlobal(REAL &x, REAL &y, const Function<REAL> &function, REAL left, REAL right, bool min = true) const = 0;
};

template <typename REAL> const REAL Extremum<REAL>::GAIN_DFLT = REAL(100.0);
template <typename REAL> const REAL Extremum<REAL>::EPS_DFLT = REAL(1.0e-6);

//------------------------------------------------------------------------------

template <typename REAL>
class ExtremumBracket : public Extremum<REAL> {
protected:
	const U32 partitions;
	const REAL gain;

	ExtremumBracket(U32 partitions, REAL gain) :
		partitions(partitions), gain(gain)
	{}

	/** Brackets the extremum starting with the initial interval [a, b] */
	bool searchLocal(REAL &a, REAL &b, REAL &c, const Function<REAL> &function, bool min = true) const {
		const REAL sign = min ? REAL(1.0) : -REAL(1.0);

		REAL fa = sign*function.get(a);
		REAL fb = sign*function.get(b);
		if (fb > fa) {
			std::swap(a, b);
			std::swap(fb, fa);
		}

		c = a + numeric_const<REAL>::GOLD1*(b - a);
		REAL fc = sign*function.get(c);
		REAL fu;
		while (fb > fc) {
			const REAL r = (b - a) * (fb - fc);
			const REAL q = (b - c) * (fb - fa);
			const REAL ulim = b + gain*(c - b);
			REAL u = b - ((b - c)*q - (b - a)*r)/(REAL(2.0) * Math::guard(q - r, REAL(0.0), numeric_const<REAL>::EPS));

			if ((b - u)*(u - c) > REAL(0.0)) {
				fu = sign*function.get(u);

				if (fu < fc) {
					Math::shift(a, b, u);
					Math::shift(fa, fb, fu);
					return true;
				}
				else if (fu > fb) {
					c = u;
					fc = fu;
					return true;
				}

				u = c + numeric_const<REAL>::GOLD1*(c - b);
				fu = sign*function.get(u);
			}
			else if ((c - u)*(u - ulim) > REAL(0.0)) {
				fu = sign*function.get(u);

				if (fu < fc) {
					Math::shift(b, c, u, u + numeric_const<REAL>::GOLD1*(u - b));
					Math::shift(fb, fc, fu, sign*function.get(u));
				}
			}
			else if ((u - ulim)*(ulim - c) >= REAL(0.0)) {
				u = ulim;
				fu = sign*function.get(u);
			}
			else {
				u = c + numeric_const<REAL>::GOLD1*(c - b);
				fu = sign*function.get(u);
			}

			Math::shift(a, b, c, u);
			Math::shift(fa, fb, fc, fu);
		}

		return true;
	}

	/** Brackets the extremum in the initial interval [a, c] */
	bool searchGlobal(REAL &a, REAL &b, REAL &c, const Function<REAL> &function, bool min = true) const {
		const REAL sign = min ? REAL(1.0) : -REAL(1.0);
		const REAL dx = (c - a)/REAL(partitions);
		const REAL left = a;

		REAL x0, x1 = left, x2 = left + dx;
		REAL f0, f1 = sign*function.get(x1), f2 = sign*function.get(x2);
		b = x1;
		c = x2;
		REAL fu = f1;
		for (U32 i = 2; i <= partitions; i++) {
			Math::shift(x0, x1, x2);
			Math::shift(f0, f1, f2);

			x2 = left + dx*REAL(i);
			f2 = sign*function.get(x2);

			if (f1 < fu && f1 < f0 && f1 < f2) {
				a = x0;
				b = x1;
				c = x2;
				fu = f1;
			}
		}

		if (f2 < fu) {
			a = x0;
			b = x1;
			c = x2;
		}

		return true;
	}

	/** Finds extremum given triple of points {a, b, c} so that a < b < c and f(a) > f(b) < f(c). */
	virtual bool find(REAL &x, REAL &y, const Function<REAL> &function, REAL a, REAL b, REAL c, bool min = true) const = 0;

public:
	/** Finds function extremum within specified interval */
	virtual bool findLocal(REAL &x, REAL &y, const Function<REAL> &function, REAL left, REAL right, bool min = true) const {
		REAL a = left, b = right, c;
		if (!searchLocal(a, b, c, function, min))
			return false;

		return find(x, y, function, a, b, c, min);
	}

	/** Finds function extremum within specified interval */
	virtual bool findGlobal(REAL &x, REAL &y, const Function<REAL> &function, REAL left, REAL right, bool min = true) const {
		REAL a = left, b, c = right;
		if (!searchGlobal(a, b, c, function, min))
			return false;

		return find(x, y, function, a, b, c, min);
	}
};

//------------------------------------------------------------------------------

template <typename REAL>
class ExtremumGold : public ExtremumBracket<REAL> {
protected:
	const REAL epsilon;

	bool find(REAL &x, REAL &y, const Function<REAL> &function, REAL a, REAL b, REAL c, bool min = true) const {
		const REAL sign = min ? REAL(1.0) : -REAL(1.0);

		REAL x0 = a, x1, x2, x3 = c;
		if (Math::abs(c - b) > Math::abs(b - a)) {
			x1 = b;
			x2 = b + (REAL(1.0) - numeric_const<REAL>::GOLD2) * (c - b);
		}
		else {
			x2 = b;
			x1 = b - (REAL(1.0) - numeric_const<REAL>::GOLD2) * (b - a);
		}

		REAL f1 = sign*function.get(x1);
		REAL f2 = sign*function.get(x2);
		while (Math::abs(x3 - x0) > epsilon*(Math::abs(x1) + Math::abs(x2)))
			if (f2 < f1) {
				Math::shift(x0, x1, x2, x3 - numeric_const<REAL>::GOLD2*(x3 - x2));
				Math::shift(f1, f2, sign*function.get(x2));
			}
			else {
				Math::shift(x3, x2, x1, x0 + numeric_const<REAL>::GOLD2*(x1 - x0));
				Math::shift(f2, f1, sign*function.get(x1));
			}

		if (f1 < f2) {
			x = x1;
			y = sign*f1;
		}
		else {
			x = x2;
			y = sign*f2;
		}

		return true;
	}

public:
	ExtremumGold(U32 partitions = Extremum<REAL>::PARTITIONS_DFLT, REAL epsilon = Extremum<REAL>::EPS_DFLT, REAL gain = Extremum<REAL>::GAIN_DFLT) :
		ExtremumBracket<REAL>(partitions, gain), epsilon(epsilon)
	{}
};

//------------------------------------------------------------------------------

};	// namespace

#endif /*_GOLEM_MATH_EXTREMUM_H_*/

repository: marc-hanheide/cogx

repo_name: marc-hanheide/cogx

extension: h


text:
SECTION = "devel/chicken"
DESCRIPTION = "Tool for analyzing log files to extract PASS/FAIL status"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://logpro.meta;md5=578ecd0626836a531318547abdc882d5"
DEPENDS_append_class-cross = " chicken-egg-format-cross chicken-egg-regex-cross chicken-egg-regex-literals-cross"
DEPENDS_append_class-crosssdk = " chicken-egg-format-crosssdk chicken-egg-regex-crosssdk chicken-egg-regex-literals-crosssdk"
DEPENDS_append_class-nativesdk = " nativesdk-chicken-egg-format nativesdk-chicken-egg-regex nativesdk-chicken-egg-regex-literals chicken-egg-format-crosssdk chicken-egg-regex-crosssdk chicken-egg-regex-literals-crosssdk"
DEPENDS = " chicken-egg-format chicken-egg-regex chicken-egg-regex-literals chicken-egg-format-cross chicken-egg-regex-cross chicken-egg-regex-literals-cross"
RDEPENDS_${PN} = " chicken-egg-format chicken-egg-regex chicken-egg-regex-literals"

SRC_URI = "http://code.call-cc.org/egg-tarballs/4/logpro/logpro-${PV}.tar.gz"

SRC_URI[md5sum] = "4971da83cf0e48d52036ba2fcf169bdc"
SRC_URI[sha256sum] = "ada8ef03f4ed3f12f9b98af9714fbbe1458c3ce1eb14dfbcdd2a33aded610d9d"

S = "${WORKDIR}/logpro-${PV}"

inherit chicken_install

BBCLASSEXTEND = "cross crosssdk nativesdk"

repository: OSSystems/meta-chicken

repo_name: OSSystems/meta-chicken


text:
SUMMARY = "btrfs: find compression type/ratio on a file or set of files"
DESCRIPTION = "compsize takes a list of files (given as arguments) on a \
btrfs filesystem and measures used compression types and effective compression ratio"

HOMEPAGE = "https://github.com/kilobyte/compsize"

LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://LICENSE;md5=302c978df31d561ea5d9e4ef17dc8563"
SECTION = "base"
DEPENDS = "btrfs-tools"

S = "${WORKDIR}/git"

SRCREV = "a7bf82296193f785757f0cb30627dce30462f085"
SRC_URI = "git://github.com/kilobyte/compsize.git"

SRC_URI[md5sum] = "5681d50f8527a8afc78b1bf108a5237f"
SRC_URI[sha256sum] = "e417c74a1cbc528527f8b29d6de98af63a5ca6afdc18063747e6ed592c87fe7e"

do_install () {
    install -d ${D}/usr/share
    install -d ${D}/usr/share/man
    install -d ${D}/usr/share/man/man8
    PREFIX=${D} make install
}

repository: edison-fw/meta-intel-edison

repo_name: edison-fw/meta-intel-edison

gha_language: Shell


text:
package leetcode

import "testing"

func TestContainsDuplicate(t *testing.T) {
	var tests = []struct {
		nums      []int
		duplicate bool
	}{
		{[]int{1, 2, 3, 1}, true},
		{[]int{1, 2, 3, 4}, false},
		{[]int{1, 1, 1, 3, 3, 4, 3, 2, 4, 2}, true},
	}

	for _, tt := range tests {
		duplicate := containsDuplicate(tt.nums)
		if duplicate != tt.duplicate {
			t.Errorf("containsDuplicate(%v) return %v, want %v", tt.nums, duplicate, tt.duplicate)
		}
	}
}

license: Unlicense

repository: invzhi/LeetCode

repo_name: invzhi/LeetCode


text:
SUMMARY = "library for USB video devices built atop libusb"
HOMEPAGE = "https://github.com/libuvc/libuvc.git"
SECTION = "libs"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=2f1963e0bb88c93463af750daf9ba0c2"
DEPENDS = "libusb jpeg"

SRC_URI = "git://github.com/libuvc/libuvc.git;branch=master;protocol=https"
SRCREV = "ad6c72a4e390367f0d2be81aac00cfc0b6680d74"
PV = "v0.0.6+git${SRCPV}"

S = "${WORKDIR}/git"

inherit cmake pkgconfig


text:
export IMAGE_BASENAME = "micro-image"
export IMAGE_TYPES = "ext4.lzma"
#export IMAGE_FSTYPES = "empty"
export IMAGE_FSTYPES = "ext4.lzma"

RPROVIDES_${PN} += "task-boot"
RREPLACES_${PN} += "task-boot"
RCONFLICTS_${PN} += "task-boot"

inherit packagegroup

PACKAGE_ARCH = "${MACHINE_ARCH}"
IMAGE_PREPROCESS_COMMAND = "rootfs_update_timestamp"

BOOTSTRAP = "at91bootstrap u-boot"
#BOOTSTRAP = " "

DEPENDS = " \
	virtual/kernel \
	${BOOTSTRAP} \
"

RDEPENDS_${PN} = " \
	angstrom-version \
	busybox \
	${@base_contains("MACHINE_FEATURES", "keyboard", "keymaps", "", d)} \
	${MACHINE_ESSENTIAL_EXTRA_RDEPENDS} \
"
#base-passwd

RRECOMMENDS_${PN} = "\
	kernel \
	${MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS} \
"

DISTRO_UPDATE_ALTERNATIVES ??= ""

# Add ${ROOTFS_PKGMANAGE_PKGS} to IMAGE_INSTALL if desired.
ROOTFS_PKGMANAGE_PKGS ?= '${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "${ROOTFS_PKGMANAGE} ${DISTRO_UPDATE_ALTERNATIVES}", d)}'

IMAGE_DEV_MANANGER = "udev"
IMAGE_INIT_MANAGER = "sysvinit"

IMAGE_INSTALL = " \
	angstrom-version \
	busybox \
	dropbear \
"

IMAGE_INITSCRIPTS = " "
#IMAGE_LOGIN_MANAGER = "tinylogin shadow"
IMAGE_LOGIN_MANAGER = " "

inherit image

do_rootfs_append () {
	mkimage -A arm -O linux -T ramdisk -C lzma -n "Linux EXT4 RD" -d ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext4.lzma ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.initrd.lzma
	rm ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext4.lzma
}

repository: olewolf/meta-atmel

repo_name: olewolf/meta-atmel


text:
// Code generated by mockery v0.0.0-dev. DO NOT EDIT.

package mocks

import (
	context "context"

	domain "github.com/kulinsky/guess_word/domain"
	mock "github.com/stretchr/testify/mock"

	uuid "github.com/google/uuid"
)

// Handler is an autogenerated mock type for the Handler type
type Handler struct {
	mock.Mock
}

// GetGameByID provides a mock function with given fields: ctx, gameID
func (_m *Handler) GetGameByID(ctx context.Context, gameID *uuid.UUID) (*domain.Game, error) {
	ret := _m.Called(ctx, gameID)

	var r0 *domain.Game
	if rf, ok := ret.Get(0).(func(context.Context, *uuid.UUID) *domain.Game); ok {
		r0 = rf(ctx, gameID)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*domain.Game)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, *uuid.UUID) error); ok {
		r1 = rf(ctx, gameID)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// GetGameStat provides a mock function with given fields: ctx, gameID
func (_m *Handler) GetGameStat(ctx context.Context, gameID *uuid.UUID) (*domain.GameStat, error) {
	ret := _m.Called(ctx, gameID)

	var r0 *domain.GameStat
	if rf, ok := ret.Get(0).(func(context.Context, *uuid.UUID) *domain.GameStat); ok {
		r0 = rf(ctx, gameID)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*domain.GameStat)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, *uuid.UUID) error); ok {
		r1 = rf(ctx, gameID)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// GetRandomWord provides a mock function with given fields: ctx
func (_m *Handler) GetRandomWord(ctx context.Context) (*domain.Word, error) {
	ret := _m.Called(ctx)

	var r0 *domain.Word
	if rf, ok := ret.Get(0).(func(context.Context) *domain.Word); ok {
		r0 = rf(ctx)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*domain.Word)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context) error); ok {
		r1 = rf(ctx)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// Guess provides a mock function with given fields: ctx, gameID, letter
func (_m *Handler) Guess(ctx context.Context, gameID *uuid.UUID, letter string) (bool, error) {
	ret := _m.Called(ctx, gameID, letter)

	var r0 bool
	if rf, ok := ret.Get(0).(func(context.Context, *uuid.UUID, string) bool); ok {
		r0 = rf(ctx, gameID, letter)
	} else {
		r0 = ret.Get(0).(bool)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, *uuid.UUID, string) error); ok {
		r1 = rf(ctx, gameID, letter)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// StartNewGame provides a mock function with given fields: ctx, attemptCount, w
func (_m *Handler) StartNewGame(ctx context.Context, attemptCount int, w *domain.Word) (*uuid.UUID, error) {
	ret := _m.Called(ctx, attemptCount, w)

	var r0 *uuid.UUID
	if rf, ok := ret.Get(0).(func(context.Context, int, *domain.Word) *uuid.UUID); ok {
		r0 = rf(ctx, attemptCount, w)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*uuid.UUID)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, int, *domain.Word) error); ok {
		r1 = rf(ctx, attemptCount, w)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}

// WordCreate provides a mock function with given fields: ctx, s
func (_m *Handler) WordCreate(ctx context.Context, s string) (*domain.Word, error) {
	ret := _m.Called(ctx, s)

	var r0 *domain.Word
	if rf, ok := ret.Get(0).(func(context.Context, string) *domain.Word); ok {
		r0 = rf(ctx, s)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*domain.Word)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
		r1 = rf(ctx, s)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}