Created
March 10, 2014 15:29
-
-
Save Elv13/9467161 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class B; | |
class A { | |
friend class B; | |
public: | |
const QByteArray content() const { | |
return QByteArray::fromRawData(content,size); | |
} | |
private: | |
A(int* count_ref,const char* c, const int s, const int k, B* m):manager(m),size(s),content(c),key(k) { | |
count = count_ref; | |
(*count)++; | |
} | |
A(const A& copy); | |
~A() { | |
(*count)++; | |
if ((*count) >= 0) | |
manager->free(key); | |
} | |
int* count; | |
B* manager; | |
const int size; | |
const char* content; | |
const int key; | |
}; | |
class B { | |
frient class A; | |
A get(QByteArray b) { | |
//create an "A" | |
} | |
private: | |
void free(int key) { | |
//free the string | |
} | |
struct MyInternalStruct { | |
char* content; | |
int size; | |
int key; | |
}; | |
QHash<int key,MyInternalStruct*> m_hCache; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment