예제 #1
0
파일: main.cpp 프로젝트: CCJY/coliru
int main() {
    std::unique_ptr<Base> pointer1(new Derived1());
    std::unique_ptr<Base> pointer2(new Derived2());
    func(pointer1.get());
    func(pointer2.get());
    return 0;
}
예제 #2
0
파일: main.c 프로젝트: angusforbes/mat594cm
int main(int argc, char** argv) {

  int i;    
  for(i = 0; i < argc; i++)
  {
    printf( "argg %d: %s\n", i, argv[i] );
  }

  int which = atoi(argv[1]);

  switch(which) {
    case 1: pointer1(); break;
    case 2: pointer2(); break;
    case 3: func1(); break;
    case 4: func2(); break;
    case 5: structs(); break;
  }
}
예제 #3
0
파일: capture.hpp 프로젝트: cuzz/redemption
    Capture( const timeval & now, int width, int height, const char * wrm_path
           , const char * png_path, const char * hash_path, const char * basename
           , bool clear_png, bool no_timestamp, auth_api * authentifier, Inifile & ini)
            : capture_wrm(ini.video.capture_wrm)
            , capture_drawable(ini.video.capture_wrm||(ini.video.png_limit > 0))
            , capture_png(ini.video.png_limit > 0)
            , enable_file_encryption(ini.globals.enable_file_encryption.get())
            , png_trans(NULL)
            , psc(NULL)
            , wrm_trans(NULL)
            , crypto_wrm_trans(NULL)
            , pnc_bmp_cache(NULL)
            , pnc(NULL)
            , drawable(NULL)
            , capture_event(wait_obj(0))
            , png_path(png_path)
            , basename(basename) {
        if (this->capture_drawable) {
            this->drawable = new RDPDrawable(width, height);
        }

        if (this->capture_png) {
            if (recursive_create_directory(png_path, S_IRWXU|S_IRWXG, ini.video.capture_groupid) != 0) {
                LOG(LOG_ERR, "Failed to create directory: \"%s\"", png_path);
            }

            this->png_trans = new OutFilenameTransport( SQF_PATH_FILE_PID_COUNT_EXTENSION, png_path
                                                      , basename, ".png", ini.video.capture_groupid, authentifier);
            this->psc = new StaticCapture( now, *this->png_trans, &(this->png_trans->seq), width, height
                                         , clear_png, ini, this->drawable->drawable);
        }

        if (this->capture_wrm) {
            if (recursive_create_directory( wrm_path
                                          , S_IRWXU | S_IRGRP | S_IXGRP, ini.video.capture_groupid) != 0) {
                LOG(LOG_ERR, "Failed to create directory: \"%s\"", wrm_path);
            }

            if (recursive_create_directory( hash_path
                                          , S_IRWXU | S_IRGRP | S_IXGRP, ini.video.capture_groupid) != 0) {
                LOG(LOG_ERR, "Failed to create directory: \"%s\"", hash_path);
            }

            TODO("there should only be one outmeta, not two. Capture code should not really care if file is encrypted or not."
                 "Here is not the right level to manage anything related to encryption.")
            TODO("Also we may wonder why we are encrypting wrm and not png"
                 "(This is related to the path split between png and wrm)."
                 "We should stop and consider what we should actually do")
            this->pnc_bmp_cache = new BmpCache(24, 600, 768, 300, 3072, 262, 12288);
            if (this->enable_file_encryption) {
                this->crypto_wrm_trans = new CryptoOutmetaTransport( wrm_path, hash_path, basename, now
                                                                   , width, height
                                                                   , ini.video.capture_groupid
                                                                   , authentifier);
                this->pnc = new NativeCapture( now, *this->crypto_wrm_trans, width, height
                                             , *this->pnc_bmp_cache, *this->drawable, ini);
            }
            else
            {
                this->wrm_trans = new OutmetaTransport( wrm_path, basename, now, width, height
                                                      , ini.video.capture_groupid
                                                      , authentifier);
                this->pnc = new NativeCapture( now, *this->wrm_trans, width, height, *this->pnc_bmp_cache
                                             , *this->drawable, ini);
            }
            this->pnc->recorder.send_input = true;
        }

        Pointer pointer0(Pointer::POINTER_CURSOR0);
        this->ptr_cache.add_pointer_static(pointer0, 0);
        if (this->drawable) {
            this->drawable->send_pointer(0, pointer0);
        }
        Pointer pointer1(Pointer::POINTER_CURSOR1);
        this->ptr_cache.add_pointer_static(pointer1, 1);
        if (this->drawable) {
            this->drawable->send_pointer(1, pointer1);
        }
    }