uniqueid.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "uniqueid.h"
00014
00015
00016 #include <kapplication.h>
00017
00018 namespace UniqueID {
00019
00023 Uml::IDType m_uniqueID;
00024
00025 Uml::IDType gen() {
00026 static char buf[20];
00027 int length = 12;
00028 int i = 0;
00029
00030 while (length--) {
00031 int r = kapp->random() % 62;
00032 r += 48;
00033 if (r > 57)
00034 r += 7;
00035 if (r > 90)
00036 r += 6;
00037 buf[i++] = char(r);
00038 }
00039 buf[i] = '\0';
00040 m_uniqueID = std::string(buf);
00041 return m_uniqueID;
00042 }
00043
00044 void init() {
00045 m_uniqueID = Uml::id_Reserved;
00046 }
00047
00048 Uml::IDType get() {
00049 return m_uniqueID;
00050 }
00051
00052 void set(Uml::IDType id) {
00053 m_uniqueID = id;
00054 }
00055
00056 }
00057
This file is part of the documentation for umbrello Version 3.1.0.