mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 05:52:38 +02:00
add UUID helper class to get UUID string without braces
This commit is contained in:
parent
13232a4c0b
commit
5a7d21f529
7 changed files with 37 additions and 7 deletions
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <AvatarData.h>
|
||||
#include <NodeList.h>
|
||||
#include <UUID.h>
|
||||
#include <VoxelConstants.h>
|
||||
|
||||
#include "Agent.h"
|
||||
|
@ -50,7 +51,7 @@ void Agent::run() {
|
|||
// figure out the URL for the script for this agent assignment
|
||||
QString scriptURLString("http://%1:8080/assignment/%2");
|
||||
scriptURLString = scriptURLString.arg(NodeList::getInstance()->getDomainIP().toString(),
|
||||
this->getUUIDStringWithoutCurlyBraces());
|
||||
uuidStringWithoutCurlyBraces(_uuid));
|
||||
|
||||
// setup curl for script download
|
||||
CURLcode curlResult;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <PacketHeaders.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <UUID.h>
|
||||
|
||||
#include "DomainServer.h"
|
||||
|
||||
|
@ -62,7 +63,7 @@ void DomainServer::civetwebUploadHandler(struct mg_connection *connection, const
|
|||
QString newPath(ASSIGNMENT_SCRIPT_HOST_LOCATION);
|
||||
newPath += "/";
|
||||
// append the UUID for this script as the new filename, remove the curly braces
|
||||
newPath += scriptAssignment->getUUIDStringWithoutCurlyBraces();
|
||||
newPath += uuidStringWithoutCurlyBraces(scriptAssignment->getUUID());
|
||||
|
||||
// rename the saved script to the GUID of the assignment and move it to the script host locaiton
|
||||
rename(path, newPath.toLocal8Bit().constData());
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
|
||||
#include "DataServerClient.h"
|
||||
|
||||
QUuid DataServerClient::_clientUUID;
|
||||
std::vector<unsigned char*> DataServerClient::_unconfirmedPackets;
|
||||
|
||||
const char DATA_SERVER_HOSTNAME[] = "data.highfidelity.io";
|
||||
const unsigned short DATA_SERVER_PORT = 3282;
|
||||
const sockaddr_in DATA_SERVER_SOCKET = socketForHostnameAndHostOrderPort(DATA_SERVER_HOSTNAME, DATA_SERVER_PORT);
|
||||
|
|
|
@ -139,10 +139,6 @@ void Assignment::setPayload(const uchar* payload, int numBytes) {
|
|||
memcpy(_payload, payload, _numPayloadBytes);
|
||||
}
|
||||
|
||||
QString Assignment::getUUIDStringWithoutCurlyBraces() const {
|
||||
return _uuid.toString().mid(1, _uuid.toString().length() - 2);
|
||||
}
|
||||
|
||||
int Assignment::packToBuffer(unsigned char* buffer) {
|
||||
int numPackedBytes = 0;
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ public:
|
|||
|
||||
void setUUID(const QUuid& uuid) { _uuid = uuid; }
|
||||
const QUuid& getUUID() const { return _uuid; }
|
||||
QString getUUIDStringWithoutCurlyBraces() const;
|
||||
void resetUUID() { _uuid = QUuid::createUuid(); }
|
||||
|
||||
Assignment::Command getCommand() const { return _command; }
|
||||
|
|
14
libraries/shared/src/UUID.cpp
Normal file
14
libraries/shared/src/UUID.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// UUID.cpp
|
||||
// hifi
|
||||
//
|
||||
// Created by Stephen Birarda on 10/7/13.
|
||||
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include "UUID.h"
|
||||
|
||||
QString uuidStringWithoutCurlyBraces(const QUuid& uuid) {
|
||||
QString uuidStringNoBraces = uuid.toString().mid(1, uuid.toString().length() - 2);
|
||||
return uuidStringNoBraces;
|
||||
}
|
16
libraries/shared/src/UUID.h
Normal file
16
libraries/shared/src/UUID.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// UUID.h
|
||||
// hifi
|
||||
//
|
||||
// Created by Stephen Birarda on 10/7/13.
|
||||
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef __hifi__UUID__
|
||||
#define __hifi__UUID__
|
||||
|
||||
#include <QtCore/QUuid>
|
||||
|
||||
QString uuidStringWithoutCurlyBraces(const QUuid& uuid);
|
||||
|
||||
#endif /* defined(__hifi__UUID__) */
|
Loading…
Reference in a new issue