File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 123123 }
124124}
125125
126+ /* Instantiate the required template specializations */
127+ %template () std::map<std::string, int >;
128+
129+ /* Make openshot.Fraction more Pythonic */
130+ %extend openshot::Fraction {
131+ %{
132+ #include < sstream>
133+ #include < map>
134+ %}
135+ double __float__ () {
136+ return $self->ToDouble ();
137+ }
138+ int __int__ () {
139+ return $self->ToInt ();
140+ }
141+ std::map<std::string, int > GetMap () {
142+ std::map<std::string, int > map1;
143+ map1.insert ({" num" , $self->num });
144+ map1.insert ({" den" , $self->den });
145+ return map1;
146+ }
147+ std::string __repr__ () {
148+ std::ostringstream result;
149+ result << $self->num << " :" << $self->den ;
150+ return result.str ();
151+ }
152+ }
153+
126154%extend openshot::OpenShotVersion {
127155 // Give the struct a string representation
128156 const std::string __str__ () {
You can’t perform that action at this time.
0 commit comments