#ifndef CONVERTER_CLASSES
#define CONVERTER_CLASSES

/*****************************************************************************\
*                                                                             *
*  Name   : COM converters                                                    *
*  Author : Chris Koeritz                                                     *
*                                                                             *
*  Purpose:                                                                   *
*                                                                             *
*    Provides several useful conversions that flip between normal objects and *
*  their bizarre COM counterparts.                                            *
*                                                                             *
*******************************************************************************
* Copyright (c) 1998-$now By Author.  This program is free software; you can  *
* redistribute it and/or modify it under the terms of the GNU General Public  *
* License as published by the Free Software Foundation; either version 2 of   *
* the License or (at your option) any later version.  This is online at:      *
*     http://www.fsf.org/copyleft/gpl.html                                    *
* Please send any updates to: fred@gruntose.com                               *
\*****************************************************************************/

#include "com_array.h"

#include <data_struct/matrix.cpp>

// forward.
class byte_array;
class string_array;

namespace com_extensions {

// converts between our templated array of bytes and the com_array (which
// can be used as a SAFEARRAY with COM).
bool COM_EXTENSION_FUNC_STYLE convert(const byte_array &from, com_array &to);
bool COM_EXTENSION_FUNC_STYLE convert(const com_array &from, byte_array &to);

// converts between arrays of variant objects and the com_array.
bool COM_EXTENSION_FUNC_STYLE convert(const array<_variant_t> &from,
    com_array &to);
bool COM_EXTENSION_FUNC_STYLE convert(const com_array &from,
    array<_variant_t> &to);

// converts between matrices of variant objects and the com_array.  note
// that while matrix (and C matrices) is row major (i.e., rows are indexed
// by the first bracketed index), the SAFEARRAY is column major (so the
// first index refers to columns instead).  this is now dealt with correctly
// by the converter, but be careful if you're using the com_array directly.
bool COM_EXTENSION_FUNC_STYLE convert(const matrix<_variant_t> &from,
    com_array &to);
bool COM_EXTENSION_FUNC_STYLE convert(const com_array &from,
    matrix<_variant_t> &to);

// converts between arrays of strings and com_arrays.
bool COM_EXTENSION_FUNC_STYLE convert(const string_array &from, com_array &to);
bool COM_EXTENSION_FUNC_STYLE convert(const com_array &from, string_array &to);

}

#endif
