aronrubin

Forum Replies Created

Viewing 10 posts - 16 through 25 (of 25 total)
  • Author
    Posts
  • in reply to: Clang Intellisense Play Nice With declspec #22172
    aronrubin
    Participant

    Same result. It is unclear to me whether that define is being carried into parsing of qobject.h and below.

    in reply to: Indentation of namespace contents #20920
    aronrubin
    Participant

    Sorry that version was after I fixed the formatting. Here are some artifacts if I just type enter after the curly brackets (lines 55 and 69):

    #pragma once
    
    #ifndef IMAGEREF_HPP_INCLUDED
    #define IMAGEREF_HPP_INCLUDED
    
    #include <cstdint>
    #include <memory>
    #include <string>
    #include <vector>
    #include <map>
    
    namespace ffm {
    
    inline constexpr uint32_t fcc( const char a, const char b, const char c, const char d ) {
      return (a | (b << 8) | (c << 16) | (d << 24));
    }
    inline constexpr uint32_t fcc( const char str[] ) {
      return (str[0] | (str[1] << 8) | (str[2] << 16) | (str[3] << 24));
    }
    
    class ImageRef {
    public:
      typedef std::function<void( const uint8_t * )> DataUnref;
      static DataUnref weak;
      
      struct Data {
        uint32_t fmt_4cc = 0;
        const uint8_t *data = nullptr;
        size_t datalength = 0;
        std::vector<uint8_t> datastore;
        DataUnref unref = nullptr;
        
        Data() = default;
        Data( uint32_t fmt_4cc, const uint8_t *data, size_t datalength, DataUnref &unref = weak ) : 
          fmt_4cc( fmt_4cc ), data( data ), datalength( datalength ), unref( unref ) { 
        }
      };
    
    
      size_t width = 0;
      size_t height = 0;
      int64_t pts = 0;
      uint32_t orig_fmt_4cc = 0;
      std::map<uint32_t, Data> datas;
      
      ImageRef() = default;
    
      ImageRef( uint32_t fmt_4cc,
                size_t width,
                size_t height,
                const uint8_t *data,
                size_t datalength = 0,
                DataUnref &unref = weak ) : 
          width(width), height(height) {
            if (data) {
              orig_fmt_4cc = fmt_4cc;
              datas.emplace( std::piecewise_construct,
                            std::forward_as_tuple( fmt_4cc ),
                            std::forward_as_tuple( fmt_4cc, data, datalength, unref ) );
        }
      }
      
      void addDataRef( uint32_t fmt_4cc,
                       size_t data_width,
                       size_t data_height,
                       const uint8_t *data,
                       size_t datalength = 0,
                       DataUnref &unref = weak ) {
                         if( fmt_4cc && data && data_width == width && data_height == height ) {
                           auto it = datas.find( fmt_4cc );
                           if (it != datas.end()) {
                             it->second = Data( fmt_4cc, data, datalength );
                           } else {
                             datas.emplace( std::piecewise_construct,
                                           std::forward_as_tuple( fmt_4cc ),
                                           std::forward_as_tuple( fmt_4cc, data, datalength, unref ) );
          }
        }
      }
    
    };
    
    ImageRef::DataUnref ImageRef::weak = nullptr;
    
    } // namespace ffm
    
    #endif // IMAGEREF_HPP_INCLUDED
    
    
    • This reply was modified 5 years, 11 months ago by aronrubin.
    in reply to: Indentation of namespace contents #20913
    aronrubin
    Participant

    Here is a small header that was funky as I wrote it. It is part of a cmake project that is being cross compiled for a Raspberry Pi (filesystem synchronized):

    #pragma once
    
    #ifndef IMAGEREF_HPP_INCLUDED
    #define IMAGEREF_HPP_INCLUDED
    
    #include <cstdint>
    #include <memory>
    #include <string>
    #include <vector>
    #include <map>
    
    namespace ffm {
    
    inline constexpr uint32_t fcc( const char a, const char b, const char c, const char d ) {
      return (a | (b << 8) | (c << 16) | (d << 24));
    }
    inline constexpr uint32_t fcc( const char str[] ) {
      return (str[0] | (str[1] << 8) | (str[2] << 16) | (str[3] << 24));
    }
    
    class ImageRef {
    public:
      typedef std::function<void( const uint8_t * )> DataUnref;
      static DataUnref weak;
      
      struct Data {
        uint32_t fmt_4cc = 0;
        const uint8_t *data = nullptr;
        size_t datalength = 0;
        std::vector<uint8_t> datastore;
        DataUnref unref = nullptr;
        
        Data() = default;
        Data( uint32_t fmt_4cc, const uint8_t *data, size_t datalength, DataUnref &unref = weak ) : 
          fmt_4cc( fmt_4cc ), data( data ), datalength( datalength ), unref( unref ) { 
        }
      };
    
    
      size_t width = 0;
      size_t height = 0;
      int64_t pts = 0;
      uint32_t orig_fmt_4cc = 0;
      std::map<uint32_t, Data> datas;
      
      ImageRef() = default;
      
      ImageRef( uint32_t fmt_4cc,
                size_t width,
                size_t height,
                const uint8_t *data,
                size_t datalength = 0,
                DataUnref &unref = weak ) : 
          width(width), height(height) {
        if (data) {
          orig_fmt_4cc = fmt_4cc;
          datas.emplace( std::piecewise_construct,
                         std::forward_as_tuple( fmt_4cc ),
                         std::forward_as_tuple( fmt_4cc, data, datalength, unref ) );
        }
      }
      
      void addDataRef( uint32_t fmt_4cc,
                       size_t data_width,
                       size_t data_height,
                       const uint8_t *data,
                       size_t datalength = 0,
                       DataUnref &unref = weak ) {
        if( fmt_4cc && data && data_width == width && data_height == height ) {
          auto it = datas.find( fmt_4cc );
          if (it != datas.end()) {
            it->second = Data( fmt_4cc, data, datalength );
          } else {
            datas.emplace( std::piecewise_construct,
                           std::forward_as_tuple( fmt_4cc ),
                           std::forward_as_tuple( fmt_4cc, data, datalength, unref ) );
          }
        }
      }
      
    };
    
    ImageRef::DataUnref ImageRef::weak = nullptr;
    
    } // namespace ffm
    
    #endif // IMAGEREF_HPP_INCLUDED
    
    in reply to: Indentation of namespace contents #20910
    aronrubin
    Participant

    Everything matches. Looking into the problem further as it appeared intermittent I have found that the indentation (not just for namespaces) while typing (newline, semicolon, or close brace) is erratic. However if I have everything written and I select the same code and Edit -> Format Select I get the desired/expected formatting style. I do have settings expressed vi Text Editor -> C/C++, Text Editor -> C/C++ (VisualGDB), .editorconfig file, and .clang-format file. All are consistent as far as I can tell.

    Attachments:
    You must be logged in to view attached files.
    in reply to: Is there a support for C ++ 17 in VisualGDB? #20908
    aronrubin
    Participant

    In order to get c++17 features for STL I had to add a command line switch in the settings in addition to the normal set(CMAKE_CXX_STANDARD 17) directive in the cmake file.

     

     

    Attachments:
    You must be logged in to view attached files.
    in reply to: VIsualGDB changed my file permission #20759
    aronrubin
    Participant

    I fully understand on the third party dependency however I am not convinced extensions are sufficiently expressive. For example “README”, “mybinary”, “myscript”, and “license” all have no extension yet would likely have different permissions applied. As a simple compromise please consider reading the first 4 bytes of extensionless files for the sequences ELF (“\x7FELF”) and shell (“#!/”).

    Thank you

    in reply to: VIsualGDB changed my file permission #20718
    aronrubin
    Participant

    Another thought is to use magic ala the “file” command or the corresponding library, libmagic, with MAGIC_MIME_TYPE. I would rather have an exclude list if all executables and scripts were included by default. Executables approximately defined by application/x-executable, application/x-sharedlib, application/x-archive, application/x-coff, application/x-coffexec, application/x-dosexec, application/javascript, text/x-shellscript, text/x-awk, text/x-gawk, text/x-nawk, text/x-python

    • This reply was modified 6 years ago by aronrubin.
    in reply to: VIsualGDB changed my file permission #20679
    aronrubin
    Participant

    I also vote for this. Especially on overwrite permissions should be preserved. More generally, unless the file is a binary or script, I don’t want execute set.

    in reply to: Synchronized path includes not found #20332
    aronrubin
    Participant

    To be clearer; the original error in the Clang IntelliSense Diagnostics Console has gone away but the symptom of the inability to index the include files persists.

    in reply to: Synchronized path includes not found #20331
    aronrubin
    Participant

    Other issues are definitely fixing in 5.4.1 but not this one. Also I found one of those messages in Clang Intellisense Diagnostics Console:

    [+0:24:19.239] Cannot update arguments for C:\Users\arubin\git\Redacted\vgdb-ssh://pi@raspit.local/home/pi/git/Redacted/src/Redacted.cpp: file not in project

    Thank you for the hard work on the other issues.

Viewing 10 posts - 16 through 25 (of 25 total)