autoexp.dat Writing custom visualizers for Visual Studio

autoexp.dat Writing custom visualizers for Visual Studio

// libWL.h
#pragma once
#ifdef LIBWL_EXPORTS
     #define LIBWL_API __declspec(dllexport)
#else
     #define LIBWL_API __declspec(dllimport)
#endif

namespace Text {
class LIBWL_API StringA
{
     struct StringAImpl;
public:
    StringA();
     virtual ~StringA();
public:
     void Format();
private:
     char* data;
    size_t size;
private:
    StringAImpl* impl;
};
}

// libWL.cpp
#include "stdafx.h"
#include "libWL.h"

using Text::StringA;
struct StringA::StringAImpl{
     string data;
};
StringA::StringA():impl( new StringAImpl()),data(NULL),size(0)
{
}
StringA::~StringA()
{
    delete impl;
}
void StringA::Format()
{
     char buf[] = "abc1234";
    impl->data.resize(23);
     this->data = &impl->data[0];
    strcpy(data,buf);
     this->size = impl->data.size();
}

; autoexp.dat
[ Visualizer ]
Text::StringA{
    preview         ( [ $e.data,s ])
    stringview      ( [ $e.data,sb ])
    children
    (
        #(
          [ data ]:$e.data,
         [ size ]:$e.size,
    #array( 
         expr: $e.data [ $i ]
         size: $e.size
        )
        )
    )
}


参见:
http://blog.csdn.net/pizi0475/article/details/5833102

你可能感兴趣的:(autoexp.dat Writing custom visualizers for Visual Studio)