miscellaneous/motionbuilder_shelf/utils.cpp

miscellaneous/motionbuilder_shelf/utils.cpp
//
// Created by Cyrille Fauvel on 11/04/13.
// (C) Copyright 2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in object code
// form for any purpose and without fee is hereby granted, provided that the above
// copyright notice appears in all copies and that both that copyright notice and
// the limited warranty and restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. AUTODESK SPECIFICALLY
// DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.
// AUTODESK, INC. DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED
// OR ERROR FREE.
//
#include "StdAfx.h"
#include <sstream>
#define BUFF_SIZE 4096
std::string format (const std::string &msg, ...) {
va_list ap ;
char text [BUFF_SIZE] ={ 0, } ;
va_start (ap, msg) ;
vsnprintf (text, BUFF_SIZE, msg.c_str (), ap) ;
va_end (ap) ;
return (std::string (text)) ;
}
std::vector<std::string> tokenize (std::string &st, char delimiter) {
std::vector<std::string> strings ;
std::istringstream f (st) ;
while ( std::getline (f, s, delimiter) )
strings.push_back (s) ;
return (strings) ;
}