예제 #1
0
 AnalysisObject_Impl::AnalysisObject_Impl(const std::string& name)
   : m_uuid(createUUID()),
     m_versionUUID(createUUID()),
     m_name(name),
     m_displayName(name),
     m_dirty(true)
 {}
예제 #2
0
 AnalysisObject_Impl::AnalysisObject_Impl(const AnalysisObject_Impl &other)
   : m_uuid(createUUID()),
     m_versionUUID(createUUID()),
     m_name(other.name()),
     m_displayName(other.displayName()),
     m_description(other.description()),
     m_dirty(true)
 {}
예제 #3
0
OSArgument::OSArgument(const std::string& name,
                       const OSArgumentType& type,
                       bool required, bool modelDependent)
  : m_uuid(createUUID()),
    m_versionUUID(createUUID()),
    m_name(name),
    m_displayName(name),
    m_type(type),
    m_required(required),
    m_modelDependent(modelDependent),
    m_isRead(false)
{}
예제 #4
0
 UUID ComponentData_Impl::createVersionUUID() {
   bool ok = setString(OS_ComponentDataFields::VersionUUID,toString(createUUID()));
   OS_ASSERT(ok);
   ok = setInt(OS_ComponentDataFields::VersionTimestamp,time(nullptr));
   OS_ASSERT(ok);
   return versionUUID();
 }
예제 #5
0
/// @cond
ComponentData::ComponentData(const Model& model)
  : ModelObject(iddObjectType(),model)
{
  OS_ASSERT(getImpl<detail::ComponentData_Impl>());
  setString(OS_ComponentDataFields::UUID,toString(createUUID()));
  setInt(OS_ComponentDataFields::CreationTimestamp,time(nullptr));
  createVersionUUID();
}
예제 #6
0
파일: UUID.cpp 프로젝트: NREL/OpenStudio
std::string createUniqueName(const std::string& prefix) {
  std::stringstream ss;
  if (!prefix.empty()) {
    ss << prefix << " ";
  }
  ss << toString(createUUID());
  return ss.str();
}
예제 #7
0
 WindowGroup::WindowGroup(const openstudio::Vector3d& outwardNormal, const model::Space& space,
                          const model::ConstructionBase& construction,
                          const boost::optional<model::ShadingControl>& shadingControl)
   : m_outwardNormal(outwardNormal), m_space(space), m_construction(construction), m_shadingControl(shadingControl)
 {
   // start with a gross name, forward translator is in charge of nice names
   m_name = "WG" + toString(createUUID());
   m_outwardNormal.normalize();
 }
예제 #8
0
FileReference::FileReference(const openstudio::path& p)
  : m_uuid(createUUID()),
    m_versionUUID(createUUID()),
    m_name(toString(p)),
    m_displayName(toString(p.filename())),
    m_path(completeAndNormalize(p)),
    m_timestampLast(),
    m_checksumCreate(checksum(m_path)),
    m_checksumLast(m_checksumCreate)
{
  try {
    m_fileType = FileReferenceType(getFileExtension(p));
  }
  catch (...) {
    m_fileType = FileReferenceType::Unknown;
  }
  update(openstudio::path());
}
예제 #9
0
bool FileReference::update(const openstudio::path& searchDirectory) {
  makePathAbsolute(searchDirectory);
  openstudio::path p = path();
  if (openstudio::filesystem::exists(p)) {
    m_timestampLast = DateTime::fromEpoch(openstudio::filesystem::last_write_time_as_time_t(p));
    m_checksumLast = checksum(p);
    m_versionUUID = createUUID();
    return true;
  }
  return false;
}
예제 #10
0
  void ObjectRecord_Impl::onChange(bool newVersion)
  {
    if (newVersion) {
      m_lastUUIDLast = m_uuidLast;
      m_lastTimestampLast = m_timestampLast;

      m_uuidLast = createUUID();
      m_timestampLast = DateTime::now();
    }

    Record_Impl::onChange(newVersion);
  }
예제 #11
0
파일: dcpdecrypt.cpp 프로젝트: Hexkbr/vlc
/* extracts and saves the AES key info from the plaintext;
 * parameter smpte is true for SMPTE DCP, false for Interop;
 * see SMPTE 430-1-2006, section 6.1.2 for the exact structure of the plaintext
 */
int AESKey::extractInfo( unsigned char * ps_plain_text, bool smpte )
{

    string s_rsa_structID( "f1dc124460169a0e85bc300642f866ab" ); /* unique Structure ID for all RSA-encrypted AES keys in a KDM */
    string s_carrier;
    char psz_hex[3];
    int i_ret, i_pos = 0;

    /* check for the structure ID */
    while( i_pos < 16 )
    {
        i_ret = snprintf( psz_hex, 3, "%02hhx", ps_plain_text[i_pos] );
        if( i_ret != 2 )
        {
            msg_Err( this->p_demux, "error while extracting structure ID from decrypted cipher" );
            return VLC_EGENERIC;
        }
        try
        {
            s_carrier.append( psz_hex );
        }
        catch( ... )
        {
            msg_Err( this->p_demux, "error while handling string" );
            return VLC_EGENERIC;
        }
        i_pos++;
    }
    if( s_carrier.compare( s_rsa_structID ) )
    {
        msg_Err( this->p_demux, "incorrect RSA structure ID: KDM may be broken" );
        return VLC_EGENERIC;
    }

    i_pos += 36;        /* TODO thumbprint, CPL ID */
    if( smpte )         /* only SMPTE DCPs have the 4-byte "KeyType" field */
        i_pos += 4;

    /* extract the AES key UUID */
    if( ( this->s_key_id = createUUID( ps_plain_text + i_pos ) ).empty() )
    {
        msg_Err( this->p_demux, "error while extracting AES Key UUID" );
        return VLC_EGENERIC;
    }
    i_pos += 16;

    i_pos += 50; /* TODO KeyEpoch */

    /* extract the AES key */
    memcpy( this->ps_key, ps_plain_text + i_pos, 16 );

    return VLC_SUCCESS;
}
예제 #12
0
bool FileReference::makePathRelative(const openstudio::path& basePath) {
  openstudio::path newPath;
  if (basePath.empty()) {
    newPath = path().filename();
  }
  else {
    newPath = relativePath(path(),basePath);
  }
  if (newPath.empty()) {
    return false;
  }
  m_path = newPath;
  m_versionUUID = createUUID();
  return true;
}
예제 #13
0
PortListener::PortListener(KService::Ptr s,
			   KConfig *config,
			   KServiceRegistry *srvreg) :
	m_port(-1),
	m_serviceRegistered(false),
	m_socket(0),
	m_config(config),
	m_srvreg(srvreg),
	m_dnssdreg(0)
{
	m_dnssdRegistered = false;

	m_uuid = createUUID();
	loadConfig(s);

	if (m_valid && m_enabled)
		acquirePort();
}
예제 #14
0
bool FileReference::update(const openstudio::path& searchDirectory,bool lastOnly) {
    makePathAbsolute(searchDirectory);
    openstudio::path p = path();
    if (boost::filesystem::exists(p)) {
        QFileInfo fileInfo(toQString(p));
        OS_ASSERT(fileInfo.exists());

        if (!lastOnly) {
            m_timestampCreate = toDateTime(fileInfo.created());
        }

        m_timestampLast = toDateTime(fileInfo.lastModified());
        m_checksumLast = checksum(p);
        m_versionUUID = createUUID();
        return true;
    }
    return false;
}
예제 #15
0
 WorkflowRecord_Impl::WorkflowRecord_Impl(const runmanager::Workflow& workflow,
                                          ProblemRecord& problemRecord,
                                          int workflowIndex)
   : ObjectRecord_Impl(problemRecord.projectDatabase(),
                       workflow.uuid(),
                       "",
                       "",
                       "",
                       createUUID()),
     m_problemRecordId(problemRecord.id()),
     m_workflowIndex(workflowIndex)
 {
   openstudio::runmanager::RunManager runManager = problemRecord.projectDatabase().runManager();
   try {
     m_runManagerWorkflowKey = runManager.persistWorkflow(workflow);
   }
   catch (const std::exception& e) {
     LOG(Error,"Could not persist workflow, because '" << e.what() << "'.");
   }
 }
예제 #16
0
void MSBuildProvider::createFiltersFile(const BuildSetup &setup, const std::string &name) {
	// No filters => no need to create a filter file
	if (_filters.empty())
		return;

	// Sort all list alphabetically
	_filters.sort();
	_compileFiles.sort();
	_includeFiles.sort();
	_otherFiles.sort();
	_resourceFiles.sort();
	_asmFiles.sort();

	const std::string filtersFile = setup.outputDir + '/' + name + getProjectExtension() + ".filters";
	std::ofstream filters(filtersFile.c_str());
	if (!filters)
		error("Could not open \"" + filtersFile + "\" for writing");

	filters << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
	           "<Project ToolsVersion=\"" << (_version >= 12 ? _version : 4) << ".0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n";

	// Output the list of filters
	filters << "\t<ItemGroup>\n";
	for (std::list<std::string>::iterator filter = _filters.begin(); filter != _filters.end(); ++filter) {
		filters << "\t\t<Filter Include=\"" << *filter << "\">\n"
		           "\t\t\t<UniqueIdentifier>" << createUUID() << "</UniqueIdentifier>\n"
		           "\t\t</Filter>\n";
	}
	filters << "\t</ItemGroup>\n";

	// Output files
	outputFilter(filters, _compileFiles, "ClCompile");
	outputFilter(filters, _includeFiles, "ClInclude");
	outputFilter(filters, _otherFiles, "None");
	outputFilter(filters, _resourceFiles, "ResourceCompile");
	outputFilter(filters, _asmFiles, "CustomBuild");

	filters << "</Project>";
}
예제 #17
0
bool FileReference::makePathAbsolute(const openstudio::path& searchDirectory) {
  // trivial completion
  openstudio::path currentPath = path();
  if (currentPath.is_complete() && openstudio::filesystem::exists(currentPath)) {
    return true;
  }
  openstudio::path workingPath(currentPath);
  // if currentPath is complete but does not exist, go to extreme measures
  if (currentPath.is_complete()) {
    workingPath = currentPath.filename();
  }
  if (searchDirectory.empty()) {
    return false;
  }
  openstudio::path newPath = openstudio::filesystem::complete(workingPath,searchDirectory);
  if (newPath.empty() || !openstudio::filesystem::exists(newPath)) {
    return false;
  }
  m_path = completeAndNormalize(newPath);
  m_versionUUID = createUUID();
  return true;
}
예제 #18
0
파일: Tag.cpp 프로젝트: CUEBoxer/OpenStudio
Tag::Tag(const std::string& name)
  : m_uuid(createUUID()), m_name(name)
{}
예제 #19
0
OSArgument::OSArgument()
  : m_uuid(createUUID()), m_versionUUID(createUUID())
{}
예제 #20
0
void MSVCProvider::createWorkspace(const BuildSetup &setup) {
	UUIDMap::const_iterator svmUUID = _uuidMap.find("scummvm");
	if (svmUUID == _uuidMap.end())
		error("No UUID for \"scummvm\" project created");

	const std::string svmProjectUUID = svmUUID->second;
	assert(!svmProjectUUID.empty());

	std::string solutionUUID = createUUID();

	std::ofstream solution((setup.outputDir + '/' + "scummvm.sln").c_str());
	if (!solution)
		error("Could not open \"" + setup.outputDir + '/' + "scummvm.sln\" for writing");

	solution << "Microsoft Visual Studio Solution File, Format Version " << _version + 1 << ".00\n";
	solution << "# Visual Studio " << getVisualStudioVersion() << "\n";

	solution << "Project(\"{" << solutionUUID << "}\") = \"scummvm\", \"scummvm" << getProjectExtension() << "\", \"{" << svmProjectUUID << "}\"\n";

	// Project dependencies are moved to vcxproj files in Visual Studio 2010
	if (_version < 10)
		writeReferences(solution);

	solution << "EndProject\n";

	// Note we assume that the UUID map only includes UUIDs for enabled engines!
	for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
		if (i->first == "scummvm")
			continue;

		solution << "Project(\"{" << solutionUUID << "}\") = \"" << i->first << "\", \"" << i->first << getProjectExtension() << "\", \"{" << i->second << "}\"\n"
		         << "EndProject\n";
	}

	solution << "Global\n"
	            "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n"
	            "\t\tDebug|Win32 = Debug|Win32\n"
				"\t\tAnalysis|Win32 = Analysis|Win32\n"
	            "\t\tRelease|Win32 = Release|Win32\n"
	            "\t\tDebug|x64 = Debug|x64\n"
				"\t\tAnalysis|x64 = Analysis|x64\n"
	            "\t\tRelease|x64 = Release|x64\n"
	            "\tEndGlobalSection\n"
	            "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n";

	for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
		solution << "\t\t{" << i->second << "}.Debug|Win32.ActiveCfg = Debug|Win32\n"
		            "\t\t{" << i->second << "}.Debug|Win32.Build.0 = Debug|Win32\n"
					"\t\t{" << i->second << "}.Analysis|Win32.ActiveCfg = Analysis|Win32\n"
					"\t\t{" << i->second << "}.Analysis|Win32.Build.0 = Analysis|Win32\n"
		            "\t\t{" << i->second << "}.Release|Win32.ActiveCfg = Release|Win32\n"
		            "\t\t{" << i->second << "}.Release|Win32.Build.0 = Release|Win32\n"
		            "\t\t{" << i->second << "}.Debug|x64.ActiveCfg = Debug|x64\n"
		            "\t\t{" << i->second << "}.Debug|x64.Build.0 = Debug|x64\n"
					"\t\t{" << i->second << "}.Analysis|x64.ActiveCfg = Analysis|x64\n"
					"\t\t{" << i->second << "}.Analysis|x64.Build.0 = Analysis|x64\n"
		            "\t\t{" << i->second << "}.Release|x64.ActiveCfg = Release|x64\n"
		            "\t\t{" << i->second << "}.Release|x64.Build.0 = Release|x64\n";
	}

	solution << "\tEndGlobalSection\n"
	            "\tGlobalSection(SolutionProperties) = preSolution\n"
	            "\t\tHideSolutionNode = FALSE\n"
	            "\tEndGlobalSection\n"
	            "EndGlobal\n";
}
예제 #21
0
 RulesetObject_Impl::RulesetObject_Impl()
   : m_uuid(createUUID()), m_versionUUID(createUUID())
 {}
예제 #22
0
 RulesetObject_Impl::RulesetObject_Impl(const RulesetObject_Impl& other)
   : m_uuid(createUUID()), m_versionUUID(createUUID())
 {}
예제 #23
0
void FileReference::setName(const std::string& newName) {
  m_name = newName;
  m_versionUUID = createUUID();
}
예제 #24
0
 void AnalysisObject_Impl::onChange(ChangeType changeType) {
   m_versionUUID = createUUID();
   m_dirty = true;
   emit changed(changeType);
 }
예제 #25
0
void FileReference::setDescription(const std::string& newDescription) {
  m_description = newDescription;
  m_versionUUID = createUUID();
}
예제 #26
0
void OSArgument::onChange() {
  m_versionUUID = createUUID();
}
예제 #27
0
void FileReference::setPath(const openstudio::path& newPath) {
  if (newPath != m_path) {
    m_path = newPath;
    m_versionUUID = createUUID();
  }
}
예제 #28
0
FileReference FileReference::clone() const {
  FileReference result(*this);
  result.m_uuid = createUUID();
  result.m_versionUUID = createUUID();
  return result;
}
예제 #29
0
파일: Tag.cpp 프로젝트: CUEBoxer/OpenStudio
Tag Tag::clone() const {
  Tag result(*this);
  result.m_uuid = createUUID();
  return result;
}
예제 #30
0
void FileReference::setDisplayName(const std::string& newDisplayName) {
  m_displayName = newDisplayName;
  m_versionUUID = createUUID();
}