<commit_before>// @(#)root/reflex:$Id$
// Author: <NAME> 2004

// Copyright CERN, CH-1211 <NAME>3, 2004-2006, All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.

#ifndef REFLEX_BUILD
# define REFLEX_BUILD
#endif

#include "Reflex/Scope.h"

#include "Reflex/internal/ScopeBase.h"

#include "Reflex/Type.h"
#include "Reflex/internal/OwnedMember.h"
#include "Reflex/internal/ScopeName.h"
#include "Reflex/TypeTemplate.h"
#include "Reflex/internal/OwnedMemberTemplate.h"
#include "Reflex/internal/InternalTools.h"
#include "Reflex/Tools.h"
#include "Reflex/DictionaryGenerator.h"

#include "Class.h"
#include "Namespace.h"
#include "DataMember.h"
#include "FunctionMember.h"
#include "Union.h"
#include "Enum.h"
#include "NameLookup.h"

//-------------------------------------------------------------------------------
Reflex::ScopeBase::ScopeBase(const char* scope,
                             TYPE scopeType):
   fScopeName(0),
   fScopeType(scopeType),
   fBasePosition(Tools::GetBasePosition(scope)) {
//-------------------------------------------------------------------------------
// Construct the dictionary information for a scope.
   std::string sname(scope);

   std::string declScope;
   std::string currScope(sname);

   if (fBasePosition) {
      declScope = sname.substr(0, fBasePosition - 2);
      currScope = std::string(sname, fBasePosition);
   }

   // Construct Scope
   Scope scopePtr = Scope::ByName(sname);

   if (scopePtr.Id() == 0) {
      // create a new Scope
      fScopeName = new ScopeName(scope, this);
   } else {
      fScopeName = (ScopeName*) scopePtr.Id();
      fScopeName->fScopeBase = this;
   }

   Scope declScopePtr = Scope::ByName(declScope);

   if (!declScopePtr) {
      if (scopeType == NAMESPACE) {
         declScopePtr = (new Namespace(declScope.c_str()))->ThisScope();
      } else { declScopePtr = (new ScopeName(declScope.c_str(), 0))->ThisScope(); }
   }

   // Set declaring Scope and sub-scopes
   fDeclaringScope = declScopePtr;

   if (fDeclaringScope) {
      fDeclaringScope.AddSubScope(this->ThisScope());
   }
}


//-------------------------------------------------------------------------------
Reflex::ScopeBase::ScopeBase():
   fScopeName(0),
   fScopeType(NAMESPACE),
   fDeclaringScope(Scope::__NIRVANA__()),
   fBasePosition(0) {
//-------------------------------------------------------------------------------
// Default constructor for the ScopeBase (used at init time for the global scope)
   fScopeName = new ScopeName("", this);
   PropertyList().AddProperty("Description", "global namespace");
}


//-------------------------------------------------------------------------------
Reflex::ScopeBase::ScopeBase(const ScopeBase&) {
//-------------------------------------------------------------------------------
// No copying allowed.
}


//-------------------------------------------------------------------------------
Reflex::ScopeBase&
Reflex::ScopeBase::operator =(const ScopeBase&) {
//-------------------------------------------------------------------------------
// No assignment allowed.
   return *this;
}<commit_msg>Remove copy c'tor and op=; they were meant to be not used and can thus remain unimplemented (but remain declared as private); fixes coverity report.<commit_after>// @(#)root/reflex:$Id$
// Author: <NAME> 2004

// Copyright CERN, CH-1211 Geneva 23, 2004-2006, All rights reserved.
//
// Permission to use, copy, modify, and distribute this software for any
// purpose is hereby granted without fee, provided that this copyright and
// permissions notice appear in all copies and derivatives.
//
// This software is provided "as is" without express or implied warranty.

#ifndef REFLEX_BUILD
# define REFLEX_BUILD
#endif

#include "Reflex/Scope.h"

#include "Reflex/internal/ScopeBase.h"

#include "Reflex/Type.h"
#include "Reflex/internal/OwnedMember.h"
#include "Reflex/internal/ScopeName.h"
#include "Reflex/TypeTemplate.h"
#include "Reflex/internal/OwnedMemberTemplate.h"
#include "Reflex/internal/InternalTools.h"
#include "Reflex/Tools.h"
#include "Reflex/DictionaryGenerator.h"

#include "Class.h"
#include "Namespace.h"
#include "DataMember.h"
#include "FunctionMember.h"
#include "Union.h"
#include "Enum.h"
#include "NameLookup.h"

//-------------------------------------------------------------------------------
Reflex::ScopeBase::ScopeBase(const char* scope,
                             TYPE scopeType):
   fScopeName(0),
   fScopeType(scopeType),
   fBasePosition(Tools::GetBasePosition(scope)) {
//-------------------------------------------------------------------------------
// Construct the dictionary information for a scope.
   std::string sname(scope);

   std::string declScope;
   std::string currScope(sname);

   if (fBasePosition) {
      declScope = sname.substr(0, fBasePosition - 2);
      currScope = std::string(sname, fBasePosition);
   }

   // Construct Scope
   Scope scopePtr = Scope::ByName(sname);

   if (scopePtr.Id() == 0) {
      // create a new Scope
      fScopeName = new ScopeName(scope, this);
   } else {
      fScopeName = (ScopeName*) scopePtr.Id();
      fScopeName->fScopeBase = this;
   }

   Scope declScopePtr = Scope::ByName(declScope);

   if (!declScopePtr) {
      if (scopeType == NAMESPACE) {
         declScopePtr = (new Namespace(declScope.c_str()))->ThisScope();
      } else { declScopePtr = (new ScopeName(declScope.c_str(), 0))->ThisScope(); }
   }

   // Set declaring Scope and sub-scopes
   fDeclaringScope = declScopePtr;

   if (fDeclaringScope) {
      fDeclaringScope.AddSubScope(this->ThisScope());
   }
}


//-------------------------------------------------------------------------------
Reflex::ScopeBase::ScopeBase():
   fScopeName(0),
   fScopeType(NAMESPACE),
   fDeclaringScope(Scope::__NIRVANA__()),
   fBasePosition(0) {
//-------------------------------------------------------------------------------
// Default constructor for the ScopeBase (used at init time for the global scope)
   fScopeName = new ScopeName("", this);
   PropertyList().AddProperty("Description", "global namespace");
}
{'fraction_non_alphanumeric': 0.2655830834779864, 'fraction_numerical': 0.007732365472621114, 'mean_word_length': 2.0766990291262135, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4125059', 'n_tokens_mistral': 1816, 'n_tokens_neox': 1744, 'n_words': 431}