1 // Aseprite Document Library 2 // Copyright (c) 2001-2018 David Capello 3 // 4 // This file is released under the terms of the MIT license. 5 // Read LICENSE.txt for more information. 6 7 #ifdef HAVE_CONFIG_H 8 #include "config.h" 9 #endif 10 11 #include "doc/anidir.h" 12 13 namespace doc { 14 convert_anidir_to_string(AniDir anidir)15std::string convert_anidir_to_string(AniDir anidir) 16 { 17 switch (anidir) { 18 case AniDir::FORWARD: return "forward"; 19 case AniDir::REVERSE: return "reverse"; 20 case AniDir::PING_PONG: return "pingpong"; 21 } 22 return ""; 23 } 24 convert_string_to_anidir(const std::string & s)25doc::AniDir convert_string_to_anidir(const std::string& s) 26 { 27 if (s == "forward") return AniDir::FORWARD; 28 if (s == "reverse") return AniDir::REVERSE; 29 if (s == "pingpong") return AniDir::PING_PONG; 30 return AniDir::FORWARD; 31 } 32 33 } // namespace doc 34