]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - plugins/entity/rotation.h
radiant: replace StringBuffer with std::string
[xonotic/netradiant.git] / plugins / entity / rotation.h
index fc2c9fbe4434d82011d7e967bec1a83446b48efc..d6b00d71853072879643059ec8592a852721bebf 100644 (file)
 
 #include "ientity.h"
 
-#include "stream/stringstream.h"
 #include "math/quaternion.h"
 #include "generic/callback.h"
 #include "stringio.h"
 
+#include <sstream>
+
 #include "angle.h"
 
 typedef float Float9[9];
@@ -58,7 +59,7 @@ inline void write_rotation( const Float9 rotation, Entity* entity, const char* k
        }
        else
        {
-               StringOutputStream value( 256 );
+               std::ostringstream value;
                value << rotation[0] << ' '
                          << rotation[1] << ' '
                          << rotation[2] << ' '
@@ -68,7 +69,7 @@ inline void write_rotation( const Float9 rotation, Entity* entity, const char* k
                          << rotation[6] << ' '
                          << rotation[7] << ' '
                          << rotation[8];
-               entity->setKeyValue( key, value.c_str() );
+               entity->setKeyValue( key, value.str().c_str() );
        }
 }
 inline void read_rotation( Float9 rotation, const char* value ){
@@ -144,12 +145,12 @@ inline void read_angle( Float9 rotation, const char* value ){
 
 class RotationKey
 {
-Callback m_rotationChanged;
+Callback<void()> m_rotationChanged;
 public:
 Float9 m_rotation;
 
 
-RotationKey( const Callback& rotationChanged )
+RotationKey( const Callback<void()>& rotationChanged )
        : m_rotationChanged( rotationChanged ){
        default_rotation( m_rotation );
 }
@@ -158,13 +159,13 @@ void angleChanged( const char* value ){
        read_angle( m_rotation, value );
        m_rotationChanged();
 }
-typedef MemberCaller1<RotationKey, const char*, &RotationKey::angleChanged> AngleChangedCaller;
+typedef MemberCaller<RotationKey, void(const char*), &RotationKey::angleChanged> AngleChangedCaller;
 
 void rotationChanged( const char* value ){
        read_rotation( m_rotation, value );
        m_rotationChanged();
 }
-typedef MemberCaller1<RotationKey, const char*, &RotationKey::rotationChanged> RotationChangedCaller;
+typedef MemberCaller<RotationKey, void(const char*), &RotationKey::rotationChanged> RotationChangedCaller;
 
 void write( Entity* entity ) const {
        Vector3 euler = matrix4_get_rotation_euler_xyz_degrees( rotation_toMatrix( m_rotation ) );