Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TheBrownShape

Pages: [1]
1
General / Re: Forward Declaration of an enum
« on: August 30, 2015, 03:00:07 pm »
I agree with you, shadowmouse. Most people do it like this. I will try this in my next project :)

2
General / Re: Forward Declaration of an enum
« on: August 30, 2015, 11:15:57 am »
No ? I like this type of declaration. There is no reason to learn the other .. give me a reason :D

3
General / Re: Forward Declaration of an enum
« on: August 29, 2015, 04:08:58 pm »
Thank you.

If you're going to get used to using only one way, I would suggest getting used to putting private at the end. Putting public first makes sense as that's the public interface wherease the private section is implementation only so can be at the end.

I use this method (public at the end) since 2 years and for me it makes sense :D I learned it like this. I will not change it now :D.

But thank you for your help!

4
General / Re: Forward Declaration of an enum
« on: August 29, 2015, 02:41:23 pm »
Okay, and an enum class is nothing else than an enum ? What's the difference ?

//Btw, I don't want to move the private stuff to the end. I learned it in my book like this and I don't want to get used to another :)

5
General / Re: Forward Declaration of an enum
« on: August 29, 2015, 01:02:03 pm »
Sorry Jesper, but I don't understand how to use this in my case. Can you give me an example with code to my specific problem .. ? Don't understand me wrong, I don't want that you write my half program and I do nothing, I just don't understand the thing with enum classes and so on .. :/ How to use this in my case ?

6
General / Forward Declaration of an enum
« on: August 28, 2015, 06:38:39 pm »
Hello,

I know that the following question is not about SFML, but I also use SFML in this project and I don't want to sign up in another forum - sry. BUT it is only a little question and it would be great if you would help me.

My problem:

I have a class with some member-variables and some member-functions. I also have an enum named "result", it's like "status". It is declared as public. But a private funktion has this enum as return-type, and at this point the compiler "don't know" the enum. Here the code:
class CQueryManager
{
private:
        sf::TcpSocket m_Socket;
        result m_ConvertSocketStatusToResult(sf::Socket::Status Status);
       
public:
        CQueryManager();
       
        enum result {OK, ERROR, DISCONNECTED, NOTREADY};
       
        result connect(sf::IpAddress IP, unsigned short Port, sf::Time Timeout = sf::Time::Zero); ///connects to the ServerQuery
        result sendCommand(std::string Command); ///sends the string to the ServerQuery
        std::string receive(); ///returns received string / returns NULL if there is nothing to receive or received nothing
};
 

So how I tell the compiler that the declaration will come a few lines later ? I tried "enum result;" before class declaration, but it did'nt work. Please help me.

Best regards.
TheBrownShape

7
Network / Re: TeamSpeak Bot / connect to TeamSpeak 3 ServerQuery
« on: August 25, 2015, 04:21:28 pm »
Thank you so much!

It works with /r/n and without the "+1". I didn't know /r before, I will look it up on Google now.
Thank you again!!!

Best regards
TheBrownShape

//Close

8
Network / TeamSpeak Bot / connect to TeamSpeak 3 ServerQuery
« on: August 25, 2015, 03:43:56 pm »
Hello,

I want to code a little TeamSpeak 3 Bot with the ServerQuery. The ServerQuery uses Telnet on port 10011. I am using Linux Ubuntu and when the server is started I can connect easy with "telnet localhost 10011" and it works finely. At first you have to login and tell the ServerQuery which virtual server you want to use. So the first 2 commands that I use everytime are "login USERNAME PASSWORD" and "use port=9987". As I said, that works fine. Now to my problem: I can connect to the server, the status is "Done". I also can receive the welcome message ("Welcome to TeamSpeak 3 the ServerQuery ...") with socket.receive(buffer, 512, received) (yes, the size of the buffer is 512 and received is a std::size_t, thats not the mistake ;) ). And I also can send the messages "login USERNAME PASSWORD" and "use port=9987" with socket.send(msg.c_str(), msg.size() + 1);, the status is always "Done". But I can't receive the answers. Normally it must say "error id=0 msg=ok". The commands are the same as them that I use in the terminal and there i get the answer "error id=0 msg=ok". Also the commands sent with SFML have no effect. When I type "clientpoke clid=1 msg=TEST" in the terminal, I get poked (I'm connected to localhost with my TeamSpeak Client also), but when I send this with SFML, nothing happens.

Why the TeamSpeak ServerQuery don't "understand" the commands, maybe its the wrong coding (UTF-8 and so) ?Please help me.

//Sorry for my bad english, I come from germany ;)

Best regards
TheBrownShape

Pages: [1]